SPUG: Parsing Huge Files
david.dyck at fluke.com
Wed Nov 28 08:14:28 PST 2007
On Tue, 27 Nov 2007 at 21:52 -0800, mayank_a at ... wrote:
> Is there a faster execution hook, where I can get last 1000 lines of huge
> file, without skipping to the end of file.
I would recommend File::ReadBackwards ! (it is like the "tac" program
in that it will read the file in reverse line order) - so you need to
take that into account - used it to read in the last 1000 lines then
perhaps you will reverse() the array you fetch.
If you don't want to install it from CPAN you could open a pipe
from "tac|" or just "tail -1000".
File::ReadBackwards.pm -- Read a file backwards by lines.
use File::ReadBackwards ;
More information about the spug-list