CS 246 Lab 3
Regular Expressions
  1. You will put the results of this lab in a file in your home directory or a subdirectory called lab3.txt. Open a terminal window and create this file with emacs.
  2. Open a second terminal window and cd to /home/mathcs/courses/cs246/discworld. For each of the following descriptions, find a regular expression that selects files meeting that description. Run egrep with the regular expression as follows: cat * | sort | uniq | egrep regexp. The first part of the pipeline will produce a list of all of the books in alphabetical order, and piping into egrep will select names matching the regular expression. You are NOT permitted to use extra commands in the pipeline or any options for egrep.
    1. Book names containing J.
    2. Book names containing J or W.
    3. Book names starting with M.
    4. Book names starting with B or S.
    5. Book names starting with A through E.
    6. Book names ending with t.
    7. Book names ending with l or t.
    8. Book names ending with a vowel (a, e, i, o, or u).
    9. Book names containing Men or Ladies.
    10. Book names containing st and me, in that order, but possibly with characters in between.
    11. Book names containing two occurrences of ee.
    12. Book names of length 10.
    13. Book names of length less than 10.
    14. Book names of length greater than 17.
    15. Book names that contain at least 3 e's.
    16. Book names that contain 0, 1, or 2 e's.
    17. Book names with a length divisible by 5.
    18. Book names with a space immediately before a vowel.
    19. Book names with no upper case vowels, M's or T's.
    20. Book names beginning with T whose length is even.
    For each part, copy the command into the lab3.txt file, along with the output. Label each part with the appropriate letter as in lab 2. The file contents should look like this:
    	    2a)
    	    cat * | sort | uniq | egrep J
    	    Carpe Jugulum
    	    Jingo
    	    Johnny and the Bomb
    	    Johnny and the DeadPart
    Put a blank line in between each part. Turn your file in with turnin.