How to remove ^M character

Philip Payne philip.payne at
Fri Aug 1 02:42:53 PDT 2003

> I ftp'd a file from windows to freebsd....not its every line 
> has ^M at its
> end.
> Is there some command in vi (or some way) by whcih ^M can be removed.
> Thanks
> Anil

At the vi command line
    :1,$:s/<here type ctrl-v then ctrl-M to get the ^M control character//

Basically it's just saying from line 1 to end($) search for ctrl-M and
replace with nothing.

Get this all the time when working with people who write router configs on
their windblows machines and send them to me.


More information about the freebsd-questions mailing list