To convert between Linux and MS-DOS newline conventions, consider the utility flip
flip -u <file>: converts <file> to unix format
flip -m <file>: convert <file> to DOS format
Apparently, Microsoft Word for Macintosh uses vertical tab (VT, ASCII 11) to mark end-of-line. When saved as "text only", these are converted to carriage return (CR, ASCII 13). Linux (and OS X) uses line feed (LF, ASCII 10) to mark end-of-line. The utility flip -u
converts between CR+LF and LF, so it does no correct this problem! I wrote a program crlf.c
to handle this situation.
You may also use awk
perl -p -i -e 's/\r/\n/g' <file> # converts from Mac to Linux, remember as perl pie.