[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How to simulate a call to 'tail' in MacPerl



>I am using the following script to read the last line from a log file.
>This works fine under Unix but I don't know how to simulate the call to
>'tail' on a Mac with MacPerl.

Couldn't you read the size file attribute and then use seek() to move close
to the end of the file, take lines until the end keeping track of where you
are per line with tell(), and then print out the last line? Not a very
elegant hack, but...it could work.

-Chris

>
>Is there a way to adapt the script so it does not have to use an external
>program?
>
>The log file is using a variable-length format. Since the log could be very
>large I'd like to avoid reading the whole file into memory...
>
>Any suggestions?

Dept of Molecular and Cell Biology      "Information wants to be free."
UC Berkeley  * Kane Lab 614 Barker Hall



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch