Apr
13

Line Terminations

By

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 '\015' < winfile.txt > 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
Categories : Linux, Mac OS X, Notes

Leave a Comment

You must be logged in to post a comment.