FLIP - Converting ASCII Files to/from Linux/Unix/Windows/DOS/MAC

3/15/2017 - Optimized for Firefox 51.0.1

This is URL: http://www.woodsmall.com/FLIP.htm

SEE: The real FLIP site - Craig Stuart's app - Stanford

COPYRIGHT 1987 thru 2017 - David R. Woodsmall

I am NOT Responsible for any Errors - Use at your own risk


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 - Craig Stuart Sapp - Stanford:

Unix and Macintosh text files use one character to indicate a new line of text. The character which is used in Unix can be represented as the hexadecimal number 0x0a (decimal number: 10) which you can see on a Unix computer if you run a file through the od command, e.g.: od -h flip.cpp , which displays the bytes in the file as hexadecimal numbers. Older Macs use 0x0d instead of 0x0a. "0x" is a marker in C programming to indicate a hexadecimal number.

On the other hand for MS-DOS based computers, a new line of text is specified by two characters: 0x0d followed by 0x0a which function similar to a typewriter: one character advances the paper one line (linefeed) and the other character moves the current positon to the beginning of the line (carriage return).

If you edit a MS-DOS ASCII file in Unix you will often see the characters ^M at the end of the line. This is the extra character 0x0d that is used to indicate a new line of text in MS-DOS. Many Windows 95 programs can recognize Unix text file newlines, so it is usually not too much problem going the other way by using Unix text files in MS-DOS.

If you edit a Mac-style text file in Unix (depending on the editor), you will see the entire file on a single line with ^M characters displayed instead of newlines.

The flip command will convert between each of these types of newline formats. Here is the usage statement for the program:

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
If you want to see what format a file is in, type flip -t filename and the program will return its analysis of the file. If the file has a mixture of methods for new lines, then the flip program will assign it to be a MS-DOS ASCII file. Analyzing or changing binary files (such as executable programs or sound or picture files) with the flip program does not make sense, since there may be 0x0a and 0x0d bytes in the file which are not intended to be new lines. However, the flip program might be able to reverse the damage if you ftp a binary file accidentally as an ascii file.

The flip program will overwrite the old version of a file with the specified format although the -t will not write anything since that option is used only to determine the type of the file.

Microsoft's WORDPAD can correctly display ASCII files written on DOS, Windowsor Linux/Unix/MAC systems. NOTEPAD, can not (Notepad must have DOS/Windows style CR/LFs [0x0A 0x0D] at end of each line). NOTEPAD can open a LOCKED file (in use), but WORDPAD can NOT open a file that is in use. See also: ASCII - More information about ASCII See also: VIM / VI at http://www.woodsmall.com/VIM.htm