Remove ^M from text files in Linux

February 12, 2006 · Posted in linux · Comment 

Use

sed -e ‘s/^M//g’ file

where ^M is the crtl-m character

normally inserted by typing Ctrl-V Ctrl-M

Alternatively, grab dos2unix from somewhere.