Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!goanna!minyos!monu6!edp367s From: edp367s@monu6.cc.monash.edu.au (Rik Harris) Newsgroups: comp.editors Subject: Re: ex search & substitution question Message-ID: <1990Aug9.003212.12140@monu6.cc.monash.edu.au> Date: 9 Aug 90 00:32:12 GMT References: <3440001@hprnd.HP.COM> <26814@nigel.ee.udel.edu> <1990Aug07.174235.28911@hoss.unl.edu> Organization: Chisholm Institute of Technology, Melb., Australia Lines: 35 sanjiv@hoss.unl.edu (Sanjiv K. Bhatia) writes: >In article <26814@nigel.ee.udel.edu> new@ee.udel.edu (Darren New) writes: >>In article <3440001@hprnd.HP.COM> brent@hprnd.HP.COM (Brent McInnis) writes: >>>But to perform it on a *range* of lines (say, lines 10 thru 20), I >>>*want* to say >>>:10,20/^#[iut]55/s/55/71/ >>within the range that also match the pattern. -- Darren [stuff deleted] >Here is my $0.02 worth. I prefer to use the substitute command 's'. >:10,20s/^#[iut]55/77/ no, this will delete the letter at the start, the letter must stay. a more complicated solution is required: :10,20s/\(^#[iut]\)55/\177/ this puts the letter at the start in a variable called \1, and replaces the whole string with the letter followed by the 77. I e-mailed the author of the original article, but it looks like there's some others who might benefit from this. rik. ------------------------------------------------------------------------------- Rik Harris - Monash University, Caulfield Campus (was Chisholm Institute) edp367s@monu6.cc.monash.edu.au <-- what the computer says it is edp367s@monu6.cc.monash.oz[.au] <-- SEEMS to work more reliably Build a system that even a fool can use, and only a fool will want to use it. -------------------------------------------------------------------------------