Line Terminations

Line terminations for different operating systems:

unix 0x0a LF
Classic Mac 0x0d CR
Windows 0x0d 0x0a CR LF

To convert a text file with DOS line termination to UNIX line termination:


tr -d '15'  unixfile.txt

or


sed s/.$// winfile.txt > unixfile.txt

To convert a unix file to a DOS file:


sed s/$/x0d/ unixfile.txt > winfile.txt

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.