in reply to Re^2: How to find content between KEYWORD and BLANKLINE then print it
in thread How to find content between KEYWORD and BLANKLINE then print it
The wording of the OP seems to imply that the blank line that ends the range should not actually be printed, as 1nickt attempts. Adding another && condition after the flip-flop achieves that.
$ perl -Mstrict -Mwarnings -E ' open my $inFH, q{<}, \ <<EOD or die $!; Seb Xavier Peter Roland Jim Xerox Paddle Yoyo EOD while ( <$inFH> ) { print if ( m{X} .. m{^\s*$} ) && ! m{^\s*$}; }' Xavier Peter Xerox Paddle $
I hope this is of interest.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to find content between KEYWORD and BLANKLINE then print it
by choroba (Cardinal) on Jan 07, 2016 at 13:39 UTC |