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:

1,$s/CTRL-VCTRL-M//g

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

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password