in reply to command line perl command to get between lines with non greedy match
C:\tmp\files>perl -ne"@out=() if /PATTERN1/; push @out,$_ if /PATTERN1 +/../PATTERN3/; END{ print @out }" input PATTERN1 SOME INFO TEXT4 TEXT5 TEXT6 PATTERN3 SOME INFO C:\tmp\files>
NB: for linux you'll need to replace " to '
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: command line perl command to get between lines with non greedy match
by LanX (Saint) on Jan 18, 2020 at 02:05 UTC |