How to remove ^M character from VI editor June 03, 2016 Inside vi [in ESC mode] type: :%s/^M//g Note: To enter ^M, type CTRL-V + M. That is, hold down the CTRL key then press V and M in succession. Read more