Vi substitution question?

Derek Martin ddm at mclinux.com
Tue Apr 4 11:54:07 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 "^" ?

Yep, rather than typing '^' and 'M', type <ctrl-v><enter> or
<ctrl-v><ctrl-m>.  Those are literal keystrokes, not strings to type.

Since these characters generally appear only once at the end of each line,
you can also shorten the switch command to:

  %s/<ctrl-v><ctrl-m>//

(the percent sign translates to "do for every line")

-- 
Derek Martin
System Administrator
Mission Critical Linux
martin at MissionCriticalLinux.com 

-
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