Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Print a previous to previous of a matching lineby ag88 (Novice) |
on Oct 08, 2013 at 09:11 UTC ( [id://1057387]=perlquestion: print w/replies, xml ) | Need Help?? |
ag88 has asked for the wisdom of the Perl Monks concerning the following question: Hello everyone. I am new to programing and new to PERL as well of course. I needed to write a script to extract some information from a large sized file. My file looks like
I basically want to extract the "query line" particularly the number after "gi" in the query line only of those that have 0 hits. So in this case my matching line would be "# 0 hits found". I have wrote a small script which extract the matching line but i am unable to extract the query line and the number after gi in the query line. My code is
The desired output which I want is the number after "gi" in the query line, only of those having 0 hits. For example in this case the output would be
The "query" line is 2line before the matching line. If some one could help me with this I would be grateful. Thanks
Back to
Seekers of Perl Wisdom
|
|