Re: Reading a log file from backwards

2007-09-05 Thread Rob Dixon
sivasakthi wrote: On Wed, 2007-09-05 at 07:06 -0400, Chas Owens wrote: On 9/4/07, sivasakthi <[EMAIL PROTECTED]> wrote: snip Thanks for your suggestions.. but i need to read a file from backwards... First time reading from backwards & set the last line position to one variable..next time read

Re: Reading a log file from backwards

2007-09-05 Thread sivasakthi
On Wed, 2007-09-05 at 07:06 -0400, Chas Owens wrote: > On 9/4/07, sivasakthi <[EMAIL PROTECTED]> wrote: > snip > > Thanks for your suggestions.. but i need to read a file from backwards... > > First time reading from backwards & set the last line position to one > > variable..next time reading ba

Re: Reading a log file from backwards

2007-09-05 Thread Chas Owens
On 9/4/07, sivasakthi <[EMAIL PROTECTED]> wrote: snip > Thanks for your suggestions.. but i need to read a file from backwards... > First time reading from backwards & set the last line position to one > variable..next time reading backwards until reach that variable position... > is it possible t

Re: Reading a log file from backwards

2007-09-04 Thread sivasakthi
> snip > > Unless you really need to read it backwards, I would suggest saving > the point you stopped processing by calling tell() on the filehandle > and saving the number given to you to a config file and then, on the > next run of program, reading the number and calling seek() on the > fileh

Re: Reading a log file from backwards

2007-09-04 Thread Chas Owens
On 9/4/07, sivasakthi <[EMAIL PROTECTED]> wrote: > Hi Guys, > > I have read a log file from backwards, the code is following, > > #!/usr/bin/perl > use strict; > use warnings; > use File::ReadBackwards; > my $bw = File::ReadBackwards->new("/log/path") or die $!; > my $line; > while (defined($line =

Reading a log file from backwards

2007-09-03 Thread sivasakthi
Hi Guys, I have read a log file from backwards, the code is following, #!/usr/bin/perl use strict; use warnings; use File::ReadBackwards; my $bw = File::ReadBackwards->new("/log/path") or die $!; my $line; while (defined($line = $bw->readline)) { print $line; } $bw->close(); In the abo