Adding ^M characters in vi
November 25th, 2008
This is an obscure one. There are lots of Web pages out there to tell you how to get rid of ^M characters in text files (dos2unix is your friend) but occasionally you need to edit a settings file on UNIX server where the file is normally edited using a Windows client. If you don't add the ^M character at the end of each line, the lines will run together next time the file is viewed in Windows.
To add a ^M in vi enter Ctrl+V followed by Ctrl+M.
Potentially similar posts
- Scan for available IP addresses – August 2011
- Fix “No topics found” issue in CHM output – November 2010
- Perl basics for beginners (on Windows) – August 2010
- UNIX on Windows (Microsoft’s little secret) – March 2010
- Preventing BBC iPlayer running all the time – November 2008