DOS to NIX text format

For those of you that have ever created a text file on windows and then transfered to a Unix or Linux system you may have run into a problem with the text format.

A text file created in DOS or windows may have a different file format than what Unix or Linux likes. The file will most likely have some extra line ending characters after each line.

There is a util available on most Linux machine called dos2unix that will fix your file.

To fix your file you can run this from a command shell

dos2unix filename

where filename is the name of the file you want to fix.

This has come in handy several times for me especially for shell scripts.

Labels: , ,