Linux centos trouble with egrep command in words folder
Posted
by
seth
on Super User
See other posts from Super User
or by seth
Published on 2013-10-26T23:53:24Z
Indexed on
2013/10/27
3:59 UTC
Read the original article
Hit count: 497
i need the commands to list these things for a class but for the life of me i cannot figure it out if anyone could offer any insight on how to get so specific with the egrep command or just answer the questions it would be highly appreciated some i have already figured out but if they look wrong any corrections may help too
- List all words that have the letter a followed immediately by the letter z. egrep {a,}{z,} words
- List all words that have the letter a followed sometime later by the letter z (there must be at least one letter in between). Egrep {a,?,z} words
- List all words that start with the letter a and end with the letter z. egrep "^a.*z$" words
- List all five letter words that start with the letter a and end with the letter z.
- List all words that start with two capital letters followed immediately by at least one lower case letter.
- List all words with two consecutive a’s or i’s or u’s. Use {2} to denote “two consecutive” and the pipe character, |, to denote “or”. egrep [a|i|o] {2} words
- List all words that contain a q where the q is not immediately followed by a u. For instance, queen should not be in your list but Iraqi should be.
- List all entries in the file that contain at least one non-letter.
© Super User or respective owner