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

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



At 15.38 -0500 1999.01.29, John Gilmore-Baldwin wrote:
>You could use the seek function in perl to get toward the end of a file
>(after doing a file size check), the read the file line by line and print
>out the last line you encounter.

You can seek directly to the end by passing seek a WHENCE of 2, and then an
offset of a negative value, so seek(F, -100, 2) would position F at 100
bytes from the end.  Then you can do what you want with the data that is
left.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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