Path: utzoo!attcan!uunet!decwrl!sdd.hp.com!hplabs!hpda!hpcupt1!hprnd!brent From: brent@hprnd.HP.COM (Brent McInnis) Newsgroups: comp.editors Subject: ex search & substitution question Message-ID: <3440001@hprnd.HP.COM> Date: 6 Aug 90 22:22:10 GMT Organization: HP Roseville Networks Division Lines: 53 I want to search a range of lines for the patterns such as #i55 #u55 #t55 at the beginning of a line, and change them to #i71 #u71 #t71 I understand that I can use :/^#[iut]55/s/55/71/ To perform this operation on the *next* line, and I understand that I can use :g/^#[iut]55/s/55/71/ to perform this operation on *all* lines in the file. 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/ But ex responds with a "Badly formed address" error. Note that I don't want to do something as simple as :10,20s/55/71 because of the risk of this changing *other* lines within the specified range with 55's in them to 71's. I want to search a specific range for the specific pattern consisting of the beginning of a line, followed by the hash, followed by one of the specfic letters I mentioned, followed by 55, and change *only those* 55's to 71's. Is it impossible to do what I am trying to do in ex? Thanks, ============================================================================ Brent McInnis Roseville Networks Division Mailstop R3NF2 System Interface Lab HP Telnet 785-4536 brent@hprnd.hp.com Long Distance (916) 785-4536