Tuesday, July 10, 2012

Dos2Unix Command

We often get issues while using the text files copied from windows/mac to unix server.
The text file from windows/mac has some special characters for tabs, carriage return or line breaks etc.You can run vi command and see that ^M  character in the file. if it exists then you need to run the dos2unix command. dos2unix command formats the text files to be usable on unix environment.

Example :  The following example formats the file myWindowsTextFile.txt copied from windows, to  myUnixTextFile.txt on unix server.
 
$dos2unix myUnixTextFile.txt < myWindowsTextFile.txt

For more details on this command please refer to its documentation:
http://linuxcommand.org/man_pages/dos2unix1.html

No comments:

Post a Comment