Control characters require an escape sequence prior to using in a search and replace operation in VIM. In Linux, the escape character is Ctl-v. Windows requires a Ctl-q.
Remove all ^M characters from a file on Linux:
%s/^V^M//g
Remove all ESCAPES (\27, ^[) from a file on Windows:
%s/^q^[//g
Leave a Reply