Tuesday, February 14, 2012

Remove %M in vi

After I concat a file using a IO redirect (>>) in linux, it causes %M to appear in every lines in a file. I don't know if I did something wrong.
But, to remove %M from file in vi / vim use this command in vi

:s/[CTRL + V][CTRL + M]//g

Note that [CTRL +V] is to press CTRL + V on the keyboard as well as [CTRL + M]
That's the replace pattern (:s/[pattern]/[replace]/) in vim and /g is to replace all occurence in a file.