Nikola Janceski wrote:
> without using 'tail' how can I get the trailing 5 lines of a large file
> quickly, without loading it all to memory?
>
> is there anyway without pop and shifting through an array foreach line?
> (<= this is the only way I could think of doing it)
>
with a little seek an
On Tue, 29 Oct 2002, zentara wrote:
> On Mon, 28 Oct 2002 13:54:28 -0500, [EMAIL PROTECTED] (Nikola
> Janceski) wrote:
>
> >without using 'tail' how can I get the trailing 5 lines of a large file
> >quickly, without loading it all to memory?
> >
> >is there anyway without pop and shifting throu
On Mon, 28 Oct 2002 13:54:28 -0500, [EMAIL PROTECTED] (Nikola
Janceski) wrote:
>without using 'tail' how can I get the trailing 5 lines of a large file
>quickly, without loading it all to memory?
>
>is there anyway without pop and shifting through an array foreach line? (<=
>this is the only way I
Hi,
This example should be good for your memory:
---
#!/usr/bin/perl -w
open(FILE, "< yourbigfile.txt") or die $!;
my @last5;
while () {
push @last5, $_;
shift @last5 if @last5 > 5;
}
print @last5;
Inspired by "Beginning Perl - Wrox".
Regards,
Jostein
Nikola Janceski wrote:
>
> without using 'tail' how can I get the trailing 5 lines of a large file
> quickly, without loading it all to memory?
>
> is there anyway without pop and shifting through an array foreach line? (<=
> this is the only way I could think of doing it)
http://search.cpan.org
}
close (FH);
}
> -Original Message-
> From: Nikola Janceski [mailto:nikola_janceski@;summithq.com]
> Sent: Monday, October 28, 2002 2:42 PM
> To: 'Kipp, James'
> Subject: RE: Trailing 5 lines of a file
>
>
> thanx... I think I can fix it
>
> without using 'tail' how can I get the trailing 5 lines of a
> large file
> quickly, without loading it all to memory?
>
> is there anyway without pop and shifting through an array
> foreach line? (<=
>
somebody posted this code last week, which gets the last line of the file
--
open F, "