in reply to match word on line - match word on another line - print lines
if u wish just try this in your file
input "test.txt"
*******************************
Title: Mary moo-cow 856 invalid
Title: the mechanics 857 valid
Title: Mary moo-cow 858 invalid
Title: the mechanics 856 valid
Title: Mary moo-cow 859 invalid
Title: the mechanics 8500 valid
undef $/; open(FIN,"d:\\temp.txt"); $str=<FIN>; close($str); while($str =~m#Title: (.*?) invalid#gi) { push(@arr,$1); } print "$_\n" for @arr;
output
***********
Mary moo-cow 856
Mary moo-cow 858
Mary moo-cow 859
|
|---|