How to replace ^M in unix to nothing?  

Monday, May 3, 2010

If you saw a lot of ^M character in your code, reason being is ^M is the character in DOS if you create the file in Windows.

If you transfer the DOS file into unix, you will see lots of ^M in your file and it is very irritating indeed.

You can do a simple magic in vi by

:%s/[crtl-v ctrl-m//g

meaning,
%s - substitute
[ctrl-v ctrl-m] - create the ^M character
// - empty
g - replace globally

AddThis Social Bookmark Button
Email this post


Design by Amanda @ Blogger Buster