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

Thank you both very much!

This is what ended up working perfectly-

use strict; use warnings; my $file = $ARGV[0]; open( my $fh, '<', $file ) or die "Can't open $file: $!"; while ( <$fh> ) { if ( /Error:/i .. /^\s*$/ ) { print; } } close $fh;
Error: was my keyword and I wanted all of the error message below it until a blank line was found.

Thanks again!

  • Comment on Re^3: How to find content between KEYWORD and BLANKLINE then print it
  • Download Code