I would recommend that you start with his step 1. Show us what command you used to get that, and a couple of lines of the output.
At some point you will probably need to use regular expressions. The man page for grep should give you some information on that. However I would recommend you get some sort of output from step 1 before delving too deeply into the regular expressions.
i found a way how to find the word which have a pair of the same letter
but what i am looking for is the opposite thing word wich the pair of the same letters are separated like:
Joined: Sep 15, 2007
Regular expressions will make your challenge far easier to solve once you understand them.
I'll assume you have the looping part of iterating through all the words in the dictionary covered...
grep uses regular expressions (I take it you figured that out already and I don't mean to insult your intelligence), but the man pages on [e]grep as Arman suggests (at least the ones I've seen) don't delve too deeply on regular expressions. There should be a "See Also" section at the bottom of the man page which will point you to the regex definition.
With that being said, here's a description of how I would approach the problem you're facing:
First off, regex isn't a programming language or anything like that that would allow you to count the number of a particular letter (or pattern) in a string. In your case, each word is a string. Think of regex as a notation for matching substring patterns within a string. The man pages discuss how to construct the substrings. A substring is considered a pattern and you can have multiple patterns in an expression. This is just what you need. To find a pattern consisting of an 'x' followed by another 'x' and no more. To back up a microsec from that statement, regular expressions are evaluated from left to right in the main string until the first pattern (substring) is matched. If there are more patterns, the main string continues to be evaluated after the last character from the previous pattern matched.
Armed with this information, here's the pseudo logic for the problem: Search from the beginning of the string and find an 'x' pattern. Continue searching after the first 'x' for another 'x' pattern Continue searching after the second 'x' for no more 'x' patterns. If the above three steps work, print the word.
I suspect the third step may give you a stumble with the regex notation. Give it a try and post your results.
-- Nothing is impossible if I'mPossible
Joined: Dec 20, 2007
You could also read a few tutorials on the web. To get you started, take a look at these ones: