The good ol' EOL (end-of-line) character...
Different operating systems use different characters to mark the end of line:
- Unix / Linux / OS X uses LF (line feed, '\n', 0x0A)
- Macs prior to OS X use CR (carriage return, '\r', 0x0D)
- Windows / DOS uses CR+LF (carriage return followed by line feed, '\r\n', 0x0D0A)
Since some of the files were very big, instead of changing line endings in TextWrangler I decided to use command line (shocking, I know).
First I executed
cat -v file-nameto confirm existence of the dreaded ^M (carriage return) at the end of every line, and then ran
tr -d '\r' < file-name > file-name-unixto generate new files without CR characters.
tr (translate character) is a nice little utility that does just that, substitutes one character with another or deletes it (like in my example). It's available on pretty much any *nix distro so no need to install additional software.