DOS vs. Unix Line Endings

Text files created on DOS/Windows machines have different line endings than files created on Unix/Linux. DOS uses carriage return and line feed ("\r\n") as a line ending, which Unix uses just line feed ("\n"). You need to be careful about transferring files between Windows machines and Unix machines to make sure the line endings are translated properly.

The CDF staff have written a thorough explanation of converting between Unix and DOS files

In the directory /u/csc207h/winter/pub/bin, you will find a little Perl program called dos2unix that will conver DOS line endings to Unix line endings. You can set your path to include this directory so that you can run the program, or you can copy it to your own bin directory. Run the program as dos2unix <filenmae>. The file <filename> is modified.

IMPORTANT: You must submit files in the CVS directory with Unix/Linux file endings. If you only use CVS to transfer files between your home machine and CDF, you should not have to worry about line endings. However, you must test your programs on CDF before you submit them. Shell programs, in particular, will fail in mysterious ways if they contain DOS line endings.

$Id: line-endings.html,v 1.1 2005/01/04 21:58:59 reid Exp $