How to get rid of all those ^M's at the end of lines:
In Vi
:%s/^M$//g
BE SURE YOU MAKE THE CTRL-M USING "CTRL-V CTRL-M" NOT BY TYPING "CARROT M"! This expression will replace all the ^M's that have carriage returns after them with nothing. (The dollar ties the search to the end of a line)
From: http://www.vim.org/tips/tip.php?tip_id=26
In Emacs
Use C-q to enter the "^M" character.
