• 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 Skinner <email@hidden>
  • Date: Sat, 11 May 2002 11:12:07 -0400

What's wrong with just...

read file "Dalai:Users:paulskin:Desktop:1024000Line6MBDocument"

Maybe you were thinking about the text to list conversion limit. I don't think that there's a limit to the data the read file command can get.


On Friday, May 10, 2002, at 06:19 PM, Paul Berkowitz wrote:

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.


--
Paul Skinner
_______________________________________________
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.

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

  • Prev by Date: Stump the list-new mount volume problem
  • Next by Date: Freedom Writers script
  • 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