Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Take advantage of the built-in word list UNIX
OS X comes with a list of all the words in Webster's 2nd International Dictionary (234,936 of them to be precise). These words can be found in the file /usr/share/dict/words. I find it useful to search this list if I'm not sure how spell a given word by using the following command:
% more /usr/share/dict/words | grep [pattern] | more
This should return a list of words from the dictionary that contain your [pattern] (don't type the square brackets) of interest.

Another interesting file is /usr/share/dict/propernames, which is a list of common (mostly Western) names (useful if you're having difficulty coming up with a name for your newborn).
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[9,526 views]  

Take advantage of the built-in word list | 7 comments | Create New Account
Click here to return to the 'Take advantage of the built-in word list' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A simpler way
Authored by: citizen.dave on Oct 30, '02 11:31:48AM
There is always another way, but this one's a bit cleaner...
grep  <pattern>  /usr/share/dict/words

- Citizen Dave

[ Reply to This | # ]
Try
Authored by: Andrea on Oct 30, '02 11:33:27AM

It's mostly the same as:

username% word [pattern]

where "word" is an alias defined in /usr/share/init/tcsh/aliases.



[ Reply to This | # ]
look
Authored by: DahDee on Oct 30, '02 01:36:44PM

/usr/bin/look will also work.

NAME
look - display lines beginning with a given string

SYNOPSIS
look [-df] [-t termchar] string [file]



[ Reply to This | # ]
look
Authored by: DahDee on Oct 30, '02 01:40:01PM

/usr/bin/look will also work.

NAME
look - display lines beginning with a given string

SYNOPSIS
look [-df] [-t termchar] string [file]



[ Reply to This | # ]
DICT works well too
Authored by: tochoa on Oct 30, '02 08:01:48PM

Try using dict at the command prompt to get the same result - like this

ner % dict banil
No definitions found for "banil", perhaps you mean:
web1913: Anil Bail Ganil Basil Banal
wn: anil bail basil banal
easton: Bani

You need: internet connection and a fink install. Bam!

Tony O



[ Reply to This | # ]
Another use for this
Authored by: ret on Oct 30, '02 08:34:18PM

There are some seriously strange words in this file.

I used this file in one of those "write a program to prove I can do it" moments. "The Sydney Morning Herald" newspaper (of Sydney, Australia), publishes a puzzle everyday called "Target". It has a 3x3 grid with one letter per cell. The object is to find as many words as possible that are four or more letters long from those letters. Plurals and proper names are not allowed, of course. The other wrinkle is that all words must contain the letter that appears in the centre cell. You must also identify the nine-letter word that uses all the letters.

Clear enough? Anyway, I wrote a perl program to solve it for the benefit of my local baristas who used to leave the puzzle on their coffee cart for customers to help solve. Something to while away the hour on the train in the morning. The joys of a unix laptop ;-)

I discovered all these weird words in that dictionary because when the program ran, it was able to find at least 50% more words than the puzzle creators believed could be found, and some of them were very strange indeed.

I know this is barely on-topic. Sorry.

cheers
RET



[ Reply to This | # ]
ispell, fer cryin' out loud!
Authored by: TXLogic on Oct 30, '02 10:22:23PM

OS X comes with a list of all the words in Webster's 2nd International
Dictionary (234,936 of them to be precise). These words can be found in
the file /usr/share/dict/words. I find it useful to search this list if
I'm not sure how spell a given word by using the following command:

% more /usr/share/dict/words | grep [pattern] | more

This should return a list of words from the dictionary that contain your
[pattern] (don't type the square brackets) of interest.

But -- what happens if you mispell, er, misspell?! Gentle OX X user, do
this:

fink install ispell

Then at yer shell prompt:

% ispell

which will greet you helpfully with:

@(#) International Ispell Version 3.2.06 08/01/01
word:

Entering "mispell" at the "word:" prompt returns:

how about: ispell, misspell
word:

(We can charitably forgive the program's mild hubris at taking its name
to be a word.)

ispell takes a filename as an argument, so if you want a quick single
line command, put the following in a file called, e.g., "spellchk" in
/usr/local/bin:

#!/bin/sh
echo $1 | ispell

Be sure to "chmod 755" it so it'll execute. Now, since in good unixy
fashion what "echo" returns with a string as an argument is essentially
a file containing that string,

% spellchk mispell

from the command line will return the suggestions above.

Solicitously,

TXLogic


[ Reply to This | # ]