Re: Reversing the lines in a file[speed, stack overflow}
Re: Reversing the lines in a file[speed, stack overflow}
- Subject: Re: Reversing the lines in a file[speed, stack overflow}
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 10 May 2002 15:19:09 -0700
On 5/10/02 10:30 AM, "Paul Skinner" <email@hidden> wrote:
>
On Friday, May 10, 2002, at 12:02 PM, Cornwall wrote:
>
>
> paragraphs of (read theFil)
>
>
When fed a really big hunk of text, this returns a list greater than AS
>
allows as the result of a single command.
>
>
Somehow the 'read as list' gets around this limit. Apparently being an
>
OSAX lets you flaunt the rules.
Here's my contribution to this discussion. It's awfully simple, so I must be
the 4000th person to come up with it, I imagine. There's no limit whatsoever
that I can discover. It even read a 100+ MB (that's MB, not KB) MBOX file
containing large encoded email attachments.
on ReadPartials(fileRef)
local b, y, r, textClump
set b to 1
set y to 30000
set r to ""
set finished to false
repeat until finished
try
set textClump to read fileRef from b to y
set r to r & textClump
on error -- last text clump
set textClump to read fileRef from b to eof
set r to r & textClump
set finished to true
end try
set {b, y} to {b + 30000, y + 30000}
end repeat
return r
end ReadPartials
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.