how to get rid of ^M character using vi

Greg Wooledge greg at wooledge.org
Sun Jan 25 08:27:31 PST 2004


If *every* line ends with ^M (which is almost always going to be the
case, if the file has been produced on a DOS/Windows system), then
you can just use this:

:%s/.$//

to delete the last character of each line.  This has an obvious
downside, but the advantages are that it's easier to type and to
read.

-- 
Greg Wooledge                  |   "Truth belongs to everybody."
greg at wooledge.org              |    - The Red Hot Chili Peppers
http://wooledge.org/~greg/     |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040125/02e0ab95/attachment.bin


More information about the freebsd-questions mailing list