[Techtalk] get rid of "^M" in a file

rike koh rikeko at no-log.org
Thu Jun 16 17:36:18 EST 2005


Am Donnerstag, 16. Juni 2005 02:03 schrieb Noir:
> I have a file (.vimrc) which was in Windoze and now at
> the end of each line of the file I have a "^M" which
> is (obviously) generating lots of errors while
> executing vim.
>
> I want to get rid of all the "^M". I can hand-hack it
> but that sound inefficient. I wanted to use "flip -u"
> but the OS I am currently in doesn't have that.
>
> Is there anything else I can use to get rid of that?
>
> TIA.
> .noir

in Vim replace that thing by typing:

	:%s/^M//g

to constitute the letter combination '^M'==> Ctrl+V then Ctrl+M
nevertheless, this will not replace the ^M by a real line break.
but, there is another possibility in Vim which is set fileformat.
	:set ff=dos 

however, here 's the vim doc that is quite more precise:
http://www.vim.org/tips/tip.php?tip_id=26

best
rike


More information about the Techtalk mailing list