• 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: Reading files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading files


  • Subject: Re: Reading files
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 19 Oct 2005 20:44:49 +1000
  • Thread-topic: Reading files

On 19/10/05 8:25 PM, "pete boardman" <email@hidden> wrote:

> It does seem sensible to use the Unix tools for this, purely for
> speed.

It's always dangerous to make assumptions about speed. For example:

set time1 to (current date)
repeat 20 times
-- your script
    set l to {11808, 175210} -- line numbers
    set oldtid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to "p;"
    set l1 to l as text
    set AppleScript's text item delimiters to oldtid
    do shell script "sed -n '" & l1 & "p' /usr/share/dict/web2"
end repeat
set time2 to (current date)
display dialog ("That took " & (time2 - time1) as text) & " seconds."

set time1 to (current date)
repeat 20 times
    set l to {11808, 175210} -- line numbers
    set theData to read file "Macintosh HD:usr:share:dict:web2"
    set x to paragraph 11808 of theData
    set y to paragraph 175210 of theData
end repeat
set time2 to (current date)
display dialog ("That took " & (time2 - time1) as text) & " seconds."

--
Shane Stanley <email@hidden>



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Reading files
      • From: Malcolm Fitzgerald <email@hidden>
    • Re: Reading files
      • From: pete boardman <email@hidden>
References: 
 >Re: Reading files (From: pete boardman <email@hidden>)

  • Prev by Date: Re: Reading files
  • Next by Date: Re: Days and hours
  • Previous by thread: Re: Reading files
  • Next by thread: Re: Reading files
  • Index(es):
    • Date
    • Thread