inserting CR/LF

Paul Slootman slootman at dri.nl
Sat May 18 05:09:24 AEST 1991


img at eng.cam.ac.uk (Ian Green) writes:
>I want to replace all occurences of LF in a file with the
>sequence CR-LF.
>
>I have tried and failed with tr and sed.  It must be easy! (I don't
>want to write code/use emacs or vi.)

Use this:

sed `echo 's,$,\r,'` < input > output

That should do it. The trouble you probably had was entering the
carriage return (\r) directly; it gets turned into a newline (\n)
by the Unix terminal handler.

Paul.



More information about the Comp.unix.wizards mailing list