Re: Trailing 5 lines of a file

2002-10-29 Thread david
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

Re: Trailing 5 lines of a file

2002-10-29 Thread George P.
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

Re: Trailing 5 lines of a file

2002-10-29 Thread zentara
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

Re: Trailing 5 lines of a file

2002-10-28 Thread Jostein Berntsen
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

Re: Trailing 5 lines of a file

2002-10-28 Thread John W. Krahn
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

RE: Trailing 5 lines of a file

2002-10-28 Thread Kipp, James
} 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

RE: Trailing 5 lines of a file

2002-10-28 Thread Kipp, James
> > 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, "