Vi substitution question?

Mark J. Dulcey mark at buttery.org
Tue Apr 4 11:26:56 EDT 2000


On Tue, 4 Apr 2000, Phil Buckley wrote:

> I just had a windows guy muck up a perl file and now each line ends
with the dreaded "^M".
> 
> My problem is I try to run :1,$s/^M//g but it doesn't seem to see the
^M's, is there a key combo I should be using besides the carrot on top of
my 6 key to put in that "^" ?

Those things shown as "^M" are really carriage return characters (decimal
character code 13), not the sequence "caret M".

You can match that in a number of ways: \r (carriage return), \015 (octal
character escape), or \x0d (hexadecimal character escape). So s/\r//g
should do the trick.


-- 
Mark J. Dulcey               mark at buttery.org
Visit my house's home page:  http://www.buttery.org/
Visit my home page:          http://www.buttery.org/markpoly/

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).



More information about the Discuss mailing list