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

Re: [MacPerl] Processing file backwards?



On Fri, 22 May 1998 15:56:04 -0500, Chris Nandor wrote:
>
>At 14.43 -0500 1998.05.22, Nam-June Joe wrote:
>>What is the most straightforward to traverse through an ascii file
>>backwards, along the lines of:
>>
>>while ($line = <FILE>)
>>{
>>        ...
>>}
>
>Well, if it is a large file, you are kinda in trouble; this is subject to
>available memory in MacPerl.  Otherwise, if it is small enough to fit into
>memory, you can do:

There's a nifty Unix program called tac (cat spelled backwards) that
reverses files line that I use all the time. I've used it on some pretty
large text files and it's never failed, so I don't think it's doing the
job all in memory. . The source is available, probably as part of the GNU
fileutils package. A look at Ne source might be instructive

Alternatively, maybe there's a clever way to use tie in this situation.

>
>
>--
>Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
>MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
>%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])
>



-------
Paul J. Schinder
schinder@pobox.com


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