Path: utzoo!attcan!uunet!rosevax!scooter!dan From: dan@scooter.rosemount.com (Dan Messinger) Newsgroups: comp.unix.questions Subject: Re: Need script to pluck lines of text from a file Keywords: AWK,script,lines,need advice Message-ID: <8957@rosevax.Rosemount.COM> Date: 3 Jul 90 17:01:20 GMT References: <1990Jun30.180958.28569@cbnewsd.att.com> Sender: jaychri@rosevax.Rosemount.COM Reply-To: dan@scooter.rosemount.com (Dan Messinger) Organization: Rosemount Industrial Lines: 36 In article <1990Jun30.180958.28569@cbnewsd.att.com>, jfb200@cbnewsd.att.com (joseph.f.baugher) writes: |> |> I am looking for a Shell script capable of doing the following job: |> |> I have a file consisting of several dozen lines of text, as per example: |> |> text in line 1 |> text in line 2 |> .... |> text in line n |> startmarker |> text in line n+1 |> text in line n+2 |> .... |> ... |> text in line n+m-1 |> endmarker |> text in line n+m+1 |> text in line n+m+2 |> .... |> .... |> where startmarker and endmarker are lines of text with characteristic |> markers in them which identify them as unique and different from the others. |> I want to be able to pipe the lines of text BETWEEN startmarker and |> endmarker to another command for further processing. Unfortunately, I do not |> know ahead of time what the numbers n and m are. |> Sounds like a job for sed. sed -n "/^startmarker/,/^endmarker/p" Dan Messinger dan@scooter.rosemount.com