Convert DOS/MAC text files to UNIX text file format

If you want to convert a dos text file with ugly ^M’s, you may use following commands;

dos2unix filefromdos < filein > fileout

sed 's/.$//' filein > fileout

sed 's/.$//' -i file

Some distributions do not include dos2unix, and fromdos/todos commands, but every single of them has sed. And to convert all files in directory ‘path’;

find path -type f -print -exec sed 's/.$//' -i {} \;