On Thu, 5 Dec 2002 14:24:03 -0500, [EMAIL PROTECTED] (Paul Kraus)
wrote:

>>snip "How to seek last 2k?"

Here's a start for you, getting the last 2k of the file.
Looping and checking for last page break is left up to you. :-)

#!/usr/bin/perl -w
use strict;

my $filename = shift or die "Usage: $0 file \n";

# Open the file in read mode 
open FILE, "<$filename" or die "Couldn't open $filename: $!";

# Rewind from the end of the file until -2k 
seek FILE,0, 2;  #go to EOF 
seek FILE,-2048,2; #get last 2k bytes 

$/=undef;
my $tail = <FILE>;
print "$tail\n";
exit;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to