Dave's Brain

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

Date: 2008apr21
OS: Linux
Keywords: letter, letters, begin

Q.  How can I find all English words that start with a certain 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.)

Amazingly, Linux has a command that does this: look.
http://linuxmanpages.com/man1/look.1.php

Of course, you can use grep to do many other queries.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Advertisements: