Dave Adams wrote:
> I have a 2 gig log file and I need to read only the last 10 lines.
> 
> I was also thinking something like:
> 
> 1. Read in File
> 2. Get number of lines
> 3. Print last ten lines
> 
> or something like that.
> 
> DA
> 
        You may want to think this out in that you want to do some type of seek 
against an filehandle to get to the end of the data otherwise you will end up 
reading all 2 gigs.  You might at least give a quick shot at 
File::Readbackwards to see what happens and time frames, etc.

Wags ;)
> On 4/19/05, Wagner, David --- Senior Programmer Analyst --- WGO
> <[EMAIL PROTECTED]> wrote:
>> Dave Adams wrote:
>>> I am new to PERL but how would I write a script that would read in a
>>> file and output the last 10 lines?
>>> 
>>> I guess it is sort of like the UNIX command of Tail.
>>> 
>>> Any ideas,  much appreciated.
>>> 
>>> DA
>>        I did a cpan search and got File::ReadBackwards .  What type
>> of files desring to read and size of said files? 
>> 
>> Wags ;)
>> 
>> *******************************************************
>> This message contains information that is confidential
>> and proprietary to FedEx Freight or its affiliates.
>> It is intended only for the recipient named and for
>> the express purpose(s) described therein.
>> Any other use is prohibited.
>> *******************************************************
>> 
>> --
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> <http://learn.perl.org/> <http://learn.perl.org/first-response>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


  • RE: Reading last 10 li... Wagner, David --- Senior Programmer Analyst --- WGO

Reply via email to