[PLUG] Translating ^M to \n

Rich Shepard rshepard at appl-ecosys.com
Mon Aug 12 23:21:55 UTC 2019


On Mon, 12 Aug 2019, Paul Heinlein

> Also, you can use "od -c" to verify the C-style character name tr will 
> recognize.
>
> od -c inffile | less

Tried this; less showed nothing until the end of the file.

Without piping output to less the last character in the file was \r.

Running 'cat <infile> | tr "\r" "\n" > <outfile> left outfile with the same
^M as infile. Strange M$ stuff I guess,

If the files are essentially single lines and I use sed with the /g option
it should replace all \r with \n, but it doesn't.

Whew! Thought I had it but that's not the case.

Thanks, Paul,

Rich




More information about the PLUG mailing list