http://rnm1978.wordpress.com/2009/03/27/remove-windows-line-feed-characters-in-vi/

Remove windows line feed characters in vi

Filed under: unix — rmoff @ 13:12

If you work with a file in Windows and Unix at some point you might end up with windows line feed characters in your Unix file. It’ll look like this:

one line of text ^M next line ^M and next line with more ^M

To remove the ^M character, load the file into vi on unix and enter as a line command the following:

:%s/^M//g

but instead of typing ^M do Ctrl-V Ctrl-M to get the charaters

On MS Windows load the file into a 'scintilla' based (Open Source) editor such as ScITE or Notepad++ and use Format -> Convert to UNIX format, then FTP the file back to Unix