Need script to pluck lines of text from a file
Rouben Rostamian
rouben at math9.math.umbc.edu
Sun Jul 1 12:54:17 AEST 1990
In article <1990Jun30.180958.28569 at cbnewsd.att.com> jfb200 at 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 at umbc.bitnet
Baltimore, MD 21228, U.S.A. rostamian at umbc3.umbc.edu
More information about the Comp.unix.questions
mailing list