CS/CE 218 Quiz #3 September 16, 1991 1. (4 pts) Fill in the following table. An ``equivalent regular expression'' is a regular expression that matches the same characters, no more and no less than the equivalent shell wild card (except that / cannot appear in a file name, and so cannot be matched by a wild card). shell wild card | equivalent regular expression ----------------|------------------------------ * | ? | [a-z] | [!a-z] | 2. (2 pts) Briefly explain why the following regular expression is redundant or wrong: [1-33] 3. Suppose that the directory . contains the following files. assert.h errno.h netdb.h stddef.h ttyent.h auevents.h exportent.h rasterfile.h sysexits.h tzfile.h ctype.h frame.h regexp.h termio.h utime.h curses.h locale.h resolv.h termios.h values.h des_crypt.h memory.h search.h time.h dirent.h mntent.h setjmp.h tiuser.h a. (2 pts) Write, in full, a command invocation (with arguments) that would print on standard output all lines in each of these files containing the characters extern buggy_function and no other lines. b. (2 pts) Write, in full, a command invocation (with arguments) that would print on standard output the number of lines that contain the characters extern buggy_function in all of the above files. 4. (2 pts) Suppose that the following data are in the file id-index (the file contains no blanks, only tabs). ------------------- ch 5 ch 3 xyz 4 i 5 i 4 ------------------- What then is the output of the following command? cut -f1 id-index | tr '[a-z]' '[A-Z]' | sort -u