Re: Spellcheck a list
Re: Spellcheck a list
- Subject: Re: Spellcheck a list
- From: Graff <email@hidden>
- Date: Mon, 04 Oct 2004 12:07:41 -0400
On Oct 4, 2004, at 9:06 AM, Jan Steinman wrote:
From: Graff <email@hidden>
you can use the "grep" command:
...
do shell script "grep " & quotedWord & " /usr/share/dict/words"
With a bit of regular expressions thrown in you could have a decently
powerful spell checker.
If you aren't going to use regular expressions, then fgrep(1) is much
faster than grep, although the difference is hardly noticeable unless
you're really crunching a huge file. ("f" as is "fixed strings" as
opposed to regular expressions.)
I did use a regular expression. I added the start-of-line marker "^"
and the end-of-line marker "$" to the string before I quoted it. I did
this so that I would get only unique matches rather than any line that
contained the string. For example:
using:
grep '^youth$' /usr/share/dict/words
gives me:
youth
using:
fgrep 'youth' /usr/share/dict/words
gives me:
overyouthful
preyouthful
reyouth
unyouthful
unyouthfully
youth
youthen
youthful
youthfullity
youthfully
youthfulness
youthhead
youthheid
youthhood
youthily
youthless
youthlessness
youthlike
youthlikeness
youthsome
youthtide
youthwort
youthy
- Ken
_______________________________________________
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