adding Windows carriage returns

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Douglas E. Miles
Date:  
Subject: adding Windows carriage returns
> 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