Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!rutgers!mcnc!decvax.dec.com!abyss.zk3.dec.com!tarsa From: tarsa@abyss.zk3.dec.com (Greg Tarsa) Newsgroups: comp.editors Subject: Re: sed address arithmetic Message-ID: <381@decvax.decvax.dec.com.UUCP> Date: 21 Sep 90 15:07:33 GMT References: <8738@neptune.inf.ethz.ch> Sender: news@decvax.dec.com.UUCP Reply-To: tarsa@abyss.zk3.dec.com (Greg Tarsa) Distribution: comp Lines: 25 In article <8738@neptune.inf.ethz.ch>, reberhar@iiic.ethz.ch (Rolf Georg Eberhardt) writes: |> Hello Netlanders |> |> Is it possible to do address arithmetic in sed? I would like to do something like |> |> /searchpattern/+3 s/^// |> |> ie. inserting the tag three lines under all the lines containing |> searchpattern. Yes, but not directly, as you have here. Try the following: /searchpattern/{n;n;n;i\ } Greg Tarsa Software Consulting -------------------------------- 33 Seabee Street Bedford, NH 03102 tarsa@elijah.mv.com (603)668-9226 {decuac,decvax}!elijah!tarsa