Removing ^M From File in Emacs

If you edit a text file on Windows and you then use it in emacs under a Linux environment you will see the ^M character at the end of each lin.

Do the following to remove it in emacs.

; goto top of buffer
M-x replace-string C-q C-m RET

The control-q will allow you to type control characters into the
input buffer.

Additionally, you could use the dos2unix command.

One thought on “Removing ^M From File in Emacs

Comments are closed.