Tales From The Geek Side

The geeky musings of Greg Rowe.

DOS to UNIX using tr

April 3rd, 2009 by greg

All too frequently I need to convert text files with DOS line endings to UNIX line endings.  It’s easy to do using tr but I can never remember the syntax.   The following strips the carriage returns (\r) and end-of-file characters (^z) from the file:

$ tr -d '\15\32' < dosfile.txt > unixfile.txt

This entry was posted on Friday, April 3rd, 2009 at 6:39 am and is filed under Geek, Tips. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply