LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-19-2010, 05:18 PM   #1
suraj sharma
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Rep: Reputation: 0
extract words frm dictionary


could u pls tell me which would be the efficient way to extract all the words(which has all the specified letters ) from a linux dictionary..

example
get all the valid words with letters with letters A,B,C,D,E,H
 
Old 06-19-2010, 05:40 PM   #2
yooy
Senior Member
 
Registered: Dec 2009
Posts: 1,387

Rep: Reputation: 173Reputation: 173
what do you mean by linux dictionary?
 
Old 06-19-2010, 08:58 PM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,252

Rep: Reputation: 205Reputation: 205Reputation: 205
It depends on what you mean by dictionary and valid words. For example: on my machine in /usr/share/dict/ directory there is a file named words. It starts with ``aback'', ends with ``zoos'' and contains 38619 words. To search through it the words containing a, b, c, d, e and h letters exclusively I use the command:

Code:
egrep -e "^[abcdeh]+$" words
In result it displays 47 words:

Code:
abbe
abed
accede
acceded
ace
ache
ached
ad
add
added
ah
ahead
babe
bad
bade
bah
be
beach
beached
beachhead
bead
beaded
bed
bedded
bee
beech
behead
cab
cache
cached
cede
ceded
dad
dead
decade
deed
deeded
each
ebb
ha
had
he
head
headache
headed
heed
heeded
On the other hand if you mean dictionary in any other format than plain ASCII text file extracting words from it could be tricky or simply impossible.
 
Old 06-20-2010, 10:19 AM   #4
suraj sharma
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Original Poster
Rep: Reputation: 0
i mean the words present in usr/share/dict/words in linux
 
Old 06-20-2010, 10:28 AM   #5
suraj sharma
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Original Poster
Rep: Reputation: 0
hey can u pls tell me how to do the same in a progaram written in java ?
can i use
egrep -e "^[abcdeh]+$" words

inside java program which runs on linux machine?
 
Old 06-20-2010, 11:54 AM   #6
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,252

Rep: Reputation: 205Reputation: 205Reputation: 205
Read that thread and don't stop on the first answer.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Look up Words in Firefox with Dictionary Search LXer Syndicated Linux News 0 12-18-2008 04:30 AM
How do I extract characters from several words on a line? MheAd Linux - Newbie 22 06-23-2008 11:22 PM
LXer: Translate words with EuroOffice Dictionary extension LXer Syndicated Linux News 0 06-09-2008 03:20 PM
How do I remove words from ispell dictionary.hash? geokker Linux - Software 1 04-20-2006 05:55 AM
edit words in aspell dictionary legolin Linux - Software 2 10-15-2004 07:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration