(Using Vi) The only hard part about this is figuring out the proper key combination to generate the regular expression. To remove the ^M's, type:
- "1,$" or "%" designates "do the following to the whole file"
- "^M" is generated by hitting "Control-V Control-M" (that's a capital V and M)
- "g" signifies "perform the substitution with every matching instance in each line"
Source: alt.unix.wizards newsgroup