This is how you remove those annoying ^M characters that show up in files previously edited on a Windows/DOS platform.
In VI,
:%s/[ctrlkey+v and ctrl-key+M]//g
actual command,
:%s/^V^M//g
Here’s a walk through video I made. My first actually
[youtube]http://www.youtube.com/watch?v=Fy_w3VDkxKU[/youtube]
Author comments are in a darker gray color for you to easily identify the posts author in the comments
Damn.. i was thinking of doing screencasts as well.
Good job man.
Thanks sir, more to come. It’s fun
hi, the ^M are showing for me on windows xp, i tried this command %s/^M//g but it doesn’t work, as soon as i put in the ctrl-m it says it cant find the pattern, is there some difference that i have to do to get to use this command on windows?
i found this to work on windows xp
%s/\r//g
to replace all ^M with nothing in the whole file
Thanks for sharing the solution ciprian.
Thanks man, very helpful.
Hi Ciprian, i am editing the file vi putty remoting from win 2008 SBS and the command %s/\r//g does’t seems to work either.
Thanks in advance
Eric,
You are remoting into a linux box or win xp box?
If linux then pres %s/Ctrl-VCtrl-M//g
The Ctrl-VCtrl-M should show up like a ^M
If on windows i dont know of any other way besides %s/\r//g
Let us know if you find out
Thanks