On Sun, 2003-01-26 at 03:35, Cameron Simpson wrote: > On 21:27 14 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote:
> | Am I close? this is more flexible than trying to build a regex that > | would do the same thing in the syntax I have used in the past. I never > | have sucessfully atomized letter combinations so I can use ? as a > | conditional. At least I don't think I have but I remember trying. > | > | I remember trying something like (from memory only) > | > | %s/({bah.*}?)(this)({.*bah}?)/$1that$3/g > > That'd do every line because the "...bah...?" is optional, so even lines with > no bah will match. Aha. That sounds familiar. I wonder if that is the reason I never could get it to work. Thanks to you and Robert for the addition to my tool kit. I don't do a great deal of stuff like this in vi, maybe because I could never figure out how to do it. It will be interesting to see if it comes up. > > | the g/foo/ one I am going to have to read up on before beginning to ask > | a question about it :) > > Thinks of it like a pre-grep for the target lines. > Yeah I get the g/foo/ part it is the .-2,.+2m0 that looks like gibberish to me :) BTW does this g/foo s/BLAH/blah/g syntax extend to tools other than vi? I can;t really think of where it would apply but I thought I would ask. Bret -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list