Dave's Brain

Browse - computer tips - find all words that start with a given prefix

Date: 2008apr21
OS: Linux

Q.  How can I find all English words that start with a certian prefix?

A.  If you are using RedHat/Fedora make sure you have the "words" package
installed:

	yum install words

Then you can do:

	grep ^Dw /usr/share/dict/words

To find all the English words that begin with "Dw".
(This was a "brain teaser" in my local newspaper today.)

Of course, you can use grep to do many other queries.

Add a comment

Sign in to add a comment
Copyright © 2008, dave - Code on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License.