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: 463

Filed under:
|

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

  1. List all words that have the letter a followed immediately by the letter z. egrep {a,}{z,} words
  2. 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
  3. List all words that start with the letter a and end with the letter z. egrep "^a.*z$" words
  4. List all five letter words that start with the letter a and end with the letter z.
  5. List all words that start with two capital letters followed immediately by at least one lower case letter.
  6. 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
  7. 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.
  8. List all entries in the file that contain at least one non-letter.

© Super User or respective owner

Related posts about terminal

Related posts about egrep