:%s/^M//g(To get the ^M hold the control key, press V then M (Both while holding the control key) and the ^M will appear.)
This command will find all occurances and replace them with nothing. Here,the :%s is a basic search and replace command in vi. It tells vi to replace the regular expression between the first and second slashes (^M) with the text between the second and third slashes (nothing in this case). The g at the end directs vi to search and replace globally (all occurrences).