Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2004 10:11:09 -0500 (EST)
From:      Jerry McAllister <jerrymc@clunix.cl.msu.edu>
To:        chkrootkit@hotmail.com (marlon corleone)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: how to get rid of ^M character using vi
Message-ID:  <200401261511.i0QFBAK14915@clunix.cl.msu.edu>
In-Reply-To: <BAY13-F62bUpm0RnzXo00012ad5@hotmail.com> 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 myfile.crs  just do:
       tr -d "\r" < myfile.crs > 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).

////jerry
> 
> cheers
> 
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?200401261511.i0QFBAK14915>