Re: Reading files
Re: Reading files
- Subject: Re: Reading files
- From: pete boardman <email@hidden>
- Date: Wed, 19 Oct 2005 11:25:27 +0100
On 19 Oct 2005, at 09:54, Wayne Melrose wrote:
On Oct 19, 2005, at 10:33 AM, Shane Stanley wrote:
Reading every line of a long file takes a long time with
applescript.
How long is a long file? If it's only a few megabytes, read it all
and
extract the text from it in AS.
Wouldn't "cat", "tail" or "head" be better? for reading the
contents of a file?
It does seem sensible to use the Unix tools for this, purely for
speed. Here's 'sed':
--
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 "
--
Pete
_______________________________________________
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