Admin Life Errors, Fixes, and Encounters

10Feb/101

vi search and replace ^M

To easily search and replace the ^M (new line) character in vi use the following command. Make sure your in command mode and not input mode when you do it.

:%s/^M$//g

to get the proper ^M in vi you'll need to do CTRL-v CTRL-M and that should display ^M

Filed under: commands, Errors, Unix 1 Comment