Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2004 10:11:09 -0500 (EST)
From:      Jerry McAllister <>
To: (marlon corleone)
Subject:   Re: how to get rid of ^M character using vi
Message-ID:  <>
In-Reply-To: <> from "marlon corleone" at Jan 25, 2004 09:43:21 AM

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
> how do i get rid of this annoying character ^M using vi, in pico i used the 
> arguments '-w'
> but what about in vi?

Those are extra carriage return characters generally displayed
as CR or ^M or \r depending on which programmers convention is
being used.

There are lots of ways to strip then including those using vi and 
sed and perl, etc.  The one I use which I find easiest is to run tr(1)  
THis is in FreeBSD standard.  You don't have to install a port just
for that like you do for some of the utilities that will do it.
Check out the man page.

Presuming your file is  just do:
       tr -d "\r" < > myfile.fixed
and it will remove (-d)  all carriage return characters ("\r") 
and write the results to myfile.fixed.

It will work for modifying other stuff across a whole file too.
You just have to learn its idea of the right conventions for 
special characters (if it involves special characters).

> cheers
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> _______________________________________________
> mailing list
> To unsubscribe, send any mail to ""

Want to link to this message? Use this URL: <>