Re: Reading files
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