David - Musings of an SRE

Getting rid of the ^Ms ...

So you've opened your text files using a visual editor like gedit and now when you open the same file in vim, you see those pesky "^M" attached to the end of each line.

Being a smart little vim'er you try to strip it off with a

:%s/^M/

But nothing happens! Instead you get a Pattern Not Found warning.

What now?

Don't worry, all you need to do is to do a:

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