Change Windows type line endings to Mac

To convert files from windows (or DOS) type line endings to UNIX or Mac flavor use “flip”

Convert DOS or Windows line endings to Unix or Mac

flip -d <filename>

Convert Unix line endings to Windows

flip -u <filename>

To install flip on Mac:

sudo port install flip

To install flip on Ubuntu Linux

sudo apt-get install flip

How do you know your line endings are DOS or Windows flavor? Open your text file with a plain text editor. If you see a “^M” at the end of every line then your line endings are DOS/Windows.

From the flip Usage instructions

Usage: flip [-t|-u|-d|-m] filename[s]
   Converts ASCII files between Unix, MS-DOS/Windows, or Macintosh newline formats
      -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