flip - unix2dos & dos2unix - Newline conversion between Unix and MS-DOS ASCII files

ASCII text files can contain different forms of newlines, depending on which operating system is being used. Converting between these formats is often necessary if you use several operating systems. The flip program will convert the newlines to any format given in the table below:

Operating System   Newline Character(s)

Microsoft Windows / MS-DOS   0Dh 0Ah
Apple Macintosh OS 9 and earlier   0Dh
Unix (e.g., Linux), also Apple OS X and higher   0Ah

Solaris systems

To convert a Windows file to a Unix file, enter:

dos2unix winfile.txt unixfile.txt

To convert a Unix file to Windows, enter:

unix2dos unixfile.txt winfile.txt


In vi, you can remove carriage return ( ^M ) characters with the following command:


Note: To input the ^M character, press Ctrl-v , and then press Enter or return.

Craig's flip.exe cannot hanlde windows unicode file.

Craig's useful command-line utilities