Please help with grep linguistics
Posted: Sun Nov 05, 2006 4:48 pm
I have literally spend 10 hours trying to figure out this question. I have tried the all sorts of combinations of grep to answer the following question for an assignment.
contents of file f3.txt (excluding the ------- )
--------------------------------------------------------------------------------------------------------
The American Revolution.
This is the best solution to the problem
PanAmerica Capital Group
the american people
ddd
United States of America
america
the brown fox jumped over a lazy dog.
Creative thinking
----------------------------------------------------------------------------------------------------------
Two questions are:
1)List all the lines in the “f3.txt” file that contain words which contain exactly one vowel.
2)List all the lines in the “f3.txt” file that contain words which begin and end with a consonant but otherwise consist only of vowels.
So far I have this:
• grep -w '^[^aeiou]*[aeiou][^aeiou]*$' f3.txt
And honestly I am not sure what this does or if its even possible to get a result using the supplied file.
Please help
contents of file f3.txt (excluding the ------- )
--------------------------------------------------------------------------------------------------------
The American Revolution.
This is the best solution to the problem
PanAmerica Capital Group
the american people
ddd
United States of America
america
the brown fox jumped over a lazy dog.
Creative thinking
----------------------------------------------------------------------------------------------------------
Two questions are:
1)List all the lines in the “f3.txt” file that contain words which contain exactly one vowel.
2)List all the lines in the “f3.txt” file that contain words which begin and end with a consonant but otherwise consist only of vowels.
So far I have this:
• grep -w '^[^aeiou]*[aeiou][^aeiou]*$' f3.txt
And honestly I am not sure what this does or if its even possible to get a result using the supplied file.
Please help