Path: utzoo!attcan!uunet!aplcen!haven!umbc3!math9.math.umbc.edu!rouben From: rouben@math9.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.unix.questions Subject: Re: Need script to pluck lines of text from a file Keywords: AWK,script,lines,need advice Message-ID: <3547@umbc3.UMBC.EDU> Date: 1 Jul 90 02:54:17 GMT References: <1990Jun30.180958.28569@cbnewsd.att.com> Sender: newspost@umbc3.UMBC.EDU Reply-To: rouben@math9.math.umbc.edu.UUCP (Rouben Rostamian) Organization: University of Maryland, Baltimore County Lines: 35 In article <1990Jun30.180958.28569@cbnewsd.att.com> jfb200@cbnewsd.att.com (joseph.f.baugher) writes: > >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. This should do: awk < infile '/startmarker/,/endmarker/ { \ if ($0 != "startmarker && $0 != "endmarker") \ print }' -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County rostamian@umbc.bitnet Baltimore, MD 21228, U.S.A. rostamian@umbc3.umbc.edu