Re: Count word's occurences
Re: Count word's occurences
- Subject: Re: Count word's occurences
- From: Christopher Stone <email@hidden>
- Date: Mon, 08 Sep 2014 12:43:04 -0500
On Sep 08, 2014, at 10:22, Christopher Stone <email@hidden> wrote:
When run from a 10,000 word file or BBEdit window using your example words the run-time is less than 2/10 of a second on my system.
______________________________________________________________________
Hey Guido,
Oh, yeah. If you want to run a TextWrangler text filter you can do this. It's just about instantaneous on the same 10K word test file.
Remember that text filters are destructive, so if you want to keep the original be sure to run on a copy.
-- Best Regards, Chris
#! /usr/bin/env bash
T=$(tr '\r' '\n'); S=$(sort -u <<< "$T"); A="";
for i in $S do X=$(grep "$i" <<< "$T" | wc -w); A="$A$i $X\n"; done
echo -e "$A" | column -t;
|
_______________________________________________
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