Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Read forward and backward - need helpby Limbic~Region (Chancellor) |
on Jan 17, 2003 at 20:44 UTC ( [id://227789]=perlquestion: print w/replies, xml ) | Need Help?? |
Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
All:
How can I read a file until I come across a piece of information, , go backwards to the start of record, and then process record from start to finish.
In the past, this is how I have accomplished it:
The problem is that this is slow and memory intensive depending on how large the record is and how far down is the information I am searching for. I would like to use seek or something to read ignoring everything until I encounter match, read backwards to start of record, and then process the whole record. Here is an example of what a file would look like: blank line START OF RECORD LINE 1 INFORMATION I AM LOOKING FOR LINE 3 LINE 4 LINE 5 LINE 6 END OF RECORD blank line START OF RECORD LINE 1 LINE 2 LINE 3 LINE 4 INFORMATION I AM LOOKING FOR LINE 6 END OF RECORD Any ideas?
Back to
Seekers of Perl Wisdom
|
|