issue: you have a file that contains windows line breaks which you want to convert to unix line breaks:
solution: see 'http://www.vim.org/tips/tip.php?tip_id=26':
It also works with
:%s/\r//g
--------
1. replace all extraneous ^M:
:%s/^M$//g
Be sure you make the ^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)
2. replace all ^M's that need to have carriage returns:
:%s/^M/ /g
Once again: Be sure you make the ^M using "CTRL-V CTRL-M" not by typing "carrot M"! This expression will replace all the ^M's that didn't have carriage returns after them with a carriage return.