[comp.unix.questions] Re^2: end of line character

maart@cs.vu.nl (Maarten Litmaath) (07/08/89)

In article <429@ncelvax.UUCP> cathy@ncelvax.UUCP (Cathy Benney) writes:
[how do I do newline conversions when moving files from UNIX to MS-DOS?]

BSD:
	% cat todos
	#!/bin/sed -f
	s/$/^M/
	% cat fromdos
	#!/bin/sed -f
	s/.$//
	%
SysV:
	% cat todos
	:
	cr="`ctrl M`"
	/bin/sed "s/$/$cr/" $1
	% cat fromdos
	:
	/bin/sed 's/.$//' $1
	%
-- 
"I HATE arbitrary limits, especially when |Maarten Litmaath @ VU Amsterdam:
   they're small."  (Stephen Savitzky)    |maart@cs.vu.nl, mcvax!botter!maart

guy@auspex.auspex.com (Guy Harris) (07/11/89)

>	% cat todos
>	#!/bin/sed -f
>	s/$/^M/

(Where "^M" stands for "a control-M", not for "'^' followed by 'M'", of
course.)

>	% cat fromdos
>	#!/bin/sed -f
>	s/.$//

Or

	#!/bin/sh -
	tr -d '\015\032'

if you want to rip extraneous ^Zs out as well.

>	cr="`ctrl M`"

You forgot to supply the "ctrl" command - it's not a standard part of S5
(I couldn't find it, anyway).  The same

	sed 's/$/^M/'

trick should work in S5 as well.