Friday, August 12, 2011

How to convert dos format text files to unix format

I needed this for some scripts I discovered they're DOS format and bash couldn't understand them. So, it's simple, and you have multiple choices:

tr -d '\r' < input.file > output.file

sed 's/$'"/`echo \\\r`/" input.file > output.file

1 comment:

  1. also dos2unix would work

    sudo apt-get install dos2unix

    dos2unix foo