Re: Best method for seeking to n lines before end of file [ implementation of tail ]
- From: John Bokma <john@xxxxxxxxxxxxxxx>
- Date: 31 May 2006 18:59:52 GMT
xhoster@xxxxxxxxx wrote:
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.
if you have to install Perl, installing a tail port shouldn't be a big
issue :-)
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
.
- References:
- Prev by Date: Re: Best method for seeking to n lines before end of file [ implementation of tail ]
- Next by Date: Re: newby question : parse xml file
- Previous by thread: Re: Best method for seeking to n lines before end of file [ implementation of tail ]
- Next by thread: Re: newby question : parse xml file
- Index(es):