adding Windows carriage returns

Douglas E. Miles doug.miles@bpxinternet.com
Wed, 19 Apr 2000 07:21:49 -0500


> Patrick Rhodes wrote:
> 
> I have text file in Linux that I need converted to Windows.  From what
> I understand, I need to add an extra carriage return or line feed at
> the end of each line to read it properly in Windows.  I can't figure
> out how to do this and I've been looking at the 'sed' at 'tr'
> commands.  I'm sure the answer is in there, but I'm unable to figure
> it out as of yet.  Can anybody help me with this?  Any and all
> information is appreciated.  Thanks!
> 
> Patrick

Put the following into a file and make it executable:

#!/usr/bin/perl -pi

s/\012/\015\012/g;

then, use it thusly (assuming you call it line_endings):

line_endings <program to convert>

Or, you can use vim (vi), to edit the file, and type this in command
mode:

:set fileformat=dos

Good luck!

-- 
- Doug

"A synonym is a word you use when you can't spell the 
word you first thought of."
--Burt Bacharach