Skip to content


Convert Mac Line Endings

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.

Usage: flip [-t|-u|-d|-m] filename[s]
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% [?]

Posted in Apple / Mac, Linux, Microsoft / Windows.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Chris says

    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;



Some HTML is OK

or, reply to this post via trackback.