Apr
13

Line Terminations

By celso

Line terminations for different operating systems:

unix 0×0a LF
Classic Mac 0×0d CR
Windows 0×0d 0×0a 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.