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 file

fromdos < 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 {} \;

Cheers.



Tags: sed text




You must be login first or sign-up for an account to post comments.

Maybe you should look at these also: