• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reversing the lines in a file[speed, stack overflow}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Reversing the lines in a file[speed, stack overflow}
      • From: Paul Skinner <email@hidden>
References: 
 >Re: Reversing the lines in a file[speed, stack overflow} (From: Paul Skinner <email@hidden>)

  • Prev by Date: Re: Reversing the lines in a file[speed, stack overflow}
  • Next by Date: Re: URL form data into a variable?
  • Previous by thread: Re: Reversing the lines in a file[speed, stack overflow}
  • Next by thread: Re: Reversing the lines in a file[speed, stack overflow}
  • Index(es):
    • Date
    • Thread