my $content = do{local $/;<$fh>}; while ($content =~ /((?:USB\d*::0x[0-9a-fA-F::]+0x[0-9a-fA-F]+::[0-9a-fA-F]+INSTR\n){2})/g) { print $1; }