I have a file like this - just much bigger:
---------------------
blah
moo
fubar
---------------------
funkytown
tic
tac
chili cheese hotdog
heartburn
---------------------
How can I search for 'tic' and output everything between the 2nd and 3rd set of dashed lines?
block_with_string.pl tic
should output
funkytown
tic
tac
chili cheese hotdog
heartburn
I appreciated this answer for printing all lines between 2 lines - just need an extra step.
To be honest, what I have is a continuous logfile of XML/SAP IDOCs. I've just not had any luck locating any helpful IDOC-centric perl info.
Split your file into sections, and then search each section for your string: Name this script
search.pl
Search for
tic
Search for
foo