Add Control M character in a text file Add Control M character in a text file unix unix

Add Control M character in a text file


The easiest way would probably be to use the unix2dos utility:

$ unix2dos myfile.txt


In vim in the insert mode and type CTRL-v CTRL-m.


In Vim, in the insert mode, Ctrl-V x##, where ## is the hex code of the character. In case of Ctrl-M the combination is Ctrl-V x0d.You can see the hex value of a character under cursor if you type :ascommand.