Re: Best method for seeking to n lines before end of file [ implementation of tail ]



graemenewlands@xxxxxxxxx wrote:
Hello,

Perhaps someone can help me with a problem I have at the moment and is
causing some debate with my colleagues:

What is the best technique

best according to what criteria?

to seek to the end of a file and load in
say, the last 10 lines like the tail command does.

I like:

open my $fh, "-|", "tail", "-10", $file or die $!;
my @foo = <$fh>;

Perhaps not best in terms of portability, though.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages