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

Horatio Davis horatio at computer.org
Thu Jun 16 06:28:26 EST 2005



On Thu, 16 Jun 2005, Noir wrote:

> 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?

If you have vim on hand, try using global search-and-replace (:s).

To enter control-M as the search string, type control-V ("quote it") and 
then the control-M. Also works for other not-normally-typeable strings, 
and in most other places in vi.

Cheers,

Horatio


More information about the Techtalk mailing list