It's kind of an iterator version of print grep /PATTERN3/, split /PATTERN1/, slurp("input")
C:\tmp\files>perl -nE" @o=() if /PATTERN1/; push @o,$_; say qq(<@o>) i +f /PATTERN3/ " input2 <PATTERN1 SOME INFO TEXT4 TEXT5 TEXT6 PATTERN3 SOME INFO > <PATTERN1 SOME INFO TEXT4 TEXT5 TEXT6 PATTERN3 SOME INFO > C:\tmp\files>
NB: this will also fire if PATTERN3 appears before the first PATTERN1!
If that's a problem, use a flag.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re: command line perl command to get between lines with non greedy match (no flip-flop)
by LanX
in thread command line perl command to get between lines with non greedy match
by ravi_perl_monks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |