Converting a DOS or MAC Text File to UNIX Format

If you are given a text file which is in DOS or MAC format it may show up as having odd characters at the line ends when viewed in emacs.

DOS to UNIX

To convert a DOS file called file.tex to UNIX format do

dos2unix file.tex

To convert it back do

unix2dos file.tex

MAC to UNIX

To convert a MAC file called file.tex to UNIX format do

tr '\015' '\012' < in_file > out_file