^M in Vim

Use vim to view some file, "^M"  appears at the end of every line, there are two methods to deal with it.

1:in Vim

:%s/<ctrl-v><ctrl-m>//g<enter> 

:w

or 

:%s/<ctrl-v><enter>//g<enter>

:w

it means %s/^M//g.

2:in terminal

$dos2unix filename


你可能感兴趣的:(unix,dos,File,vim,Terminal,methods)