Removing DOS characters using vi
Files copied from DOS/Windows often contain spurious characters when viewed in Unix. There's a number of ways to remove these, for example the dos2unix command.
One easy way is to use vi. For example, to remove ^M characters from a file, simply vi the file and enter:
Pressing the Ctrl and V keys together cause vi to interpret any further key strokes literally. So the above command changes any occurrence of ^M characters into nothing