29 How to convert DOS file to Unix?

tr -d '\015' < file.txt > new_file.txt

Just make sure not to use the same file above, else it will be wiped out.

http://stackoverflow.com/questions/2613800/how-to-convert-dos-windows-newline-crlf-to-unix-newline-n-in-bash-script

or just do sudo apt-get install dos2unix and type dos2unix foo.txt it will overwrite the file ok.