http://www.perlmonks.org?node_id=614103


in reply to regex to match the following

perl -nle 'm/type="stored-procedure"/ and m/id="([^"]+)"/ and print "$ +1"' {input_file}