RE: Count word's occurences
RE: Count word's occurences
- Subject: RE: Count word's occurences
- From: "Lanphier, Daniel A." <email@hidden>
- Date: Mon, 08 Sep 2014 12:47:12 +0000
- Thread-topic: Count word's occurences
Try Os command “grep apple|wc –w”
Dan Lanphier
Systems Engineer • Systems Operations
w: 402.498.1567 |
m: 402.680.0613
|
This message is privileged and confidential and is intended only for the use of the addressee. Unauthorized use of this message is strictly prohibited. If you
received this transmission in error, please immediately contact the sender and destroy the message. Thank you.
|
From: applescript-users-bounces+daniel.lanphier=email@hidden [mailto:applescript-users-bounces+daniel.lanphier=email@hidden]
On Behalf Of Guido Tangorra
Sent: Monday, September 8, 2014 2:53 AM
To: Applescript Users List
Subject: Count word's occurences
I'm generating a text document in TextWrangler, a sort of name list, dinamically with AS.
This could be an example of the file I'm generating:
I need to print the occurrences of every word in this document too.
So I would something like:
#Word Counter
on
findLr(the_string,
charTF)
set AppleScript's
text item delimiters
to charTF
--use of the searched string to separate bits
set the_list
to text items
of the_string
--put those bits in a list
set charNbr
to ((count
of the_list) - 1)
--count those bits, minus 1
set AppleScript's
text item delimiters
to ""
return charNbr
end
findLr
This is working fine, but I'm wondering if there's a better or a more efficient way to do the same. Maybe with grep or ASObjC Runner or with a built-in command in TextWrangler.
The file has thousands of lines and it's generated dynamically so the performances are critical.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden