I wasted an hour last week messing with a CSV file I was massaging data in for import into a large SQL database only to find out the reason the import kept dying was because of the Mac line endings. There are many shell script, Perl scripts and shell one liners to convert line endings but I found a program called flip available for OSX, WinXP and Linux that can convert between all three.
Converts ASCII files between Unix, MS-DOS/Windows, or Macintosh newline formats
Options:
-u = convert file(s) to Unix newline format (newline)
-d = convert file(s) to MS-DOS/Windows newline format (linefeed + newline)
-m = convert file(s) to Macintosh newline format (linefeed)
-t = display current file type, no file modifications
They are linked here locally as well:
Popularity: 23% [?]
Use it like this if you will (Assuming you want to convert all cpp and h line endings to dos):
cd to project directory
find . -name ‘*.cpp’ | xargs /tools/flip -d; find . -name ‘*.h’ | xargs /tools/flip -d;