Thursday, March 13, 2008

Remove ^M character

When you edit text file created in Windows system,
you sometimes encounter '^M' character at the end of each line
and found you can't remove '^M' because you can't type '^M' character.

The reason why those files contain ^M character is that the new line
character in Windows system '\r\n' while it's '\n' in unix system.

^M can be removed in VIM with below command
( ^M could be typed by cntl+v+enter )


:%s/^M//g