The program /software/gnu/bin/grep
(man -M /software/gnu/man grep)
uses regular expressions to match lines in the input.
Use grep and the list of words /usr/dict/words
to solve the following word problems.
For example, to find words that begin
and end with a vowel, use:
grep -i -x -E '([aeiou].*[aeiou]|[aeiou])' /usr/dict/words
Or, using grep twice
grep -i -E '^[aeiou]' /usr/dict/words | grep -i -E '[aeiou]$'
Explain how you used grep to come up with the solution.
- List all the words with four or more consecutive vowels
- List all the words in which the letter "q" is
not followed by the letter "u".
- Find the longest words with letters in alphabetical order
(no repeated letters),
for example, "adept", "below", "dirty", and "empty".
- Find a nine-letter word whose third letter is 'r', remove
the 'r', divide the remaining eight letters in half,
reverse the order of the letters in each half, and get
two four-letter antonyms.
Hint: you may wish to use /usr/bin/sed
to reverse the letters.