Keep cool, man, most of the compilers simply ignore that ^M thing. It should only be a slight lack of comfort for you.
Here is how to make the mass substitution using vi (sorry, vi is very basic but some people still use it).
First open your file using vi. In a Unix window, type :
vi myfile.cpp
You will see the vi screen, not very comfortable but let's use it.
Type type following sequence. the sequence starts with (Esc) which is my way of saying that you must press the Escape key (at the upper left of your keybord). the escape key tells vi that you are entering the command mode, instad of the text browsing mode. type the following :
(Esc) :%s/(Ctrl-V)(Ctrl-M)//
(finishing with Enter, of course).
So, here :
(Ctrl-V) means, press and keep pressing the Ctrl key while pressing the v key.
(Ctrl-M) means, "press and keep pressing the control key while pressing the m key".
in the "%s" string, s means "Substitue" and "%" means "in the whole document).
/first/second/ means replace "first" by "second".
(Ctrl-V) means "what follows is a control sequence, accept it with executing it"
(Ctrl-M) is the control sequence for "next line"
so /(Ctrl-V)(Ctrl-M)/ which is the ^M you don't like, will be replaced with //, whic his nothing.
This is a very long explanation for the lot of things which will be done by the simple command line. Don't really worry about that long explanation, simply type my line :
(Esc) :%s/(Ctrl-V)(Ctrl-M)//
You will see all the ^M disappear. Then save your text and exit by typing
(Esc) :wq
(wq means : write and quit).
Hope this helped
Comment/Reply (w/o sign-up)