tsk1979 has asked for the wisdom of the Perl Monks concerning the following question:
Now in the above case suppose I know the exact line number at which the regexp occurs, what I could do is a tail ($length - $line.no) and process the file. But if I dont then the above solution will not work. Also I was thinking If I know that the regexp occurs near the end of the file I cound use a readbackwards to get the file pointer till that regexp point and then start parsing the file. For that I need to know if there is a way to take the pointer to a certain line number. For example If I want while(<FH) {} to start parsing from line no 10000, how to do that?open FH, "file"; while (<FH>) { last if /regexp/; } while (<FH>) { do something; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Handling large files
by davido (Cardinal) on Apr 27, 2006 at 05:50 UTC | |
|
Re: Handling large files
by TedPride (Priest) on Apr 27, 2006 at 06:11 UTC | |
|
Re: Handling large files
by GrandFather (Saint) on Apr 27, 2006 at 05:09 UTC | |
|
Re: Handling large files
by ioannis (Abbot) on Apr 27, 2006 at 06:45 UTC | |
|
Re: Handling large files
by cdarke (Prior) on Apr 27, 2006 at 11:46 UTC | |
by davido (Cardinal) on Apr 27, 2006 at 16:35 UTC | |
|
Re: Handling large files
by unobe (Scribe) on Apr 28, 2006 at 04:34 UTC |