How to insert carriage return before line feed?

I am doing some edi where translations had to be run on unix. Generally when I run the translations on windows, the output file has both carriage returns and line feed where as when ran on unix will have only line feed. I need to insert carriage return before the line feed. Is there some tool that or script that I can use to do this?

You can use either unix2dos or something similar, depending on your system.

If you're doing your editing in vi, you can :set ff=dos

if you need to batch process a bunch of files, you can do this:

perl -i -pe 's/$/\r/' <file> <another file>

or, for a whole directory...

perl -i -pe 's/$/\r/' `/bin/ls`

There's probably a way of doing that with sed also, but I'm new-skool :cool: