been searching here and got close but seems like still not quite what i'm trying to do. eg. please consider following sample test input, the objective is to find matches that span multiple lines that start with line that contains "abc" (print this line), and ends with line that contains "efg" (also print this line), and also print the lines in between.
yyabc}
000
iiabc<
{efg+1}
111
yyabc}
222
p {efg+13}
zzz
z {efg+243} {}
iii
oooabc>
ooo
The closest that came to meeting what i'm looking for is, with zzz as the test input file with above lines,
sed -e '/abc/,/efg/!d' zzz
, but includes extra lines, that wouldn't mind not being there,
yyabc} <<***** extra
000 <<***** extra
iiabc<
{efg+1}
yyabc}
222
p {efg+13}
oooabc> <<***** extra
ooo <<***** extra
, thus expected output is,
iiabc<
{efg+1}
yyabc}
222
p {efg+13}
Besides relying on pcregrep (i have everything else in the linux box), is there a solution that can produce such multiple lines matching?
Thanks much.