how to get rid of ^M character using vi
Jerry McAllister
jerrymc at clunix.cl.msu.edu
Mon Jan 26 07:11:20 PST 2004
>
> 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
More information about the freebsd-questions
mailing list