tedesco.net.au

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

Remove ^M using VI

E-mail Print
User Rating: / 5
PoorBest 

Have you ever opened a file in VI(M) and you are completely overwhelmed by the number of ^M characters in the file. I find it extremely distracting and have to get rid of them.

Well in VI(M) there is an easy way to do this.

 

:%s/^M//g

To get the ^M character all you need to do is the following key combination: <ctrl>+v, <ctrl>+m

Now all the ^Ms are gone and you can concentrate on the real content of the file instead of those ^M characters.

 

You are here: Linux Bash Remove ^M using VI