HW4: Pipes, uniq, wc and grep. Purpose: more unix experience, particularly with pipes. (Refer to Chapter 5, pgs. 70-74 of Unix text) If you execute a program called "x4" it will produce a huge amount of output, far more than you store on a disk. (Try it: type "x4" and watch all that output fly across the screen. You can stop the program by typing control-C.... you won't want to wait for it to complete!) Using uniq and/or wc and/or grep (the "and" implies a pipe): (1) Find out how many output lines contain your last name. (2) Find out how many output lines contain your last name if duplicate adjacent lines are eliminated. (A line is an "duplicate adjacent line" if it is exactly the same as the line before.) The order of operations matters here, remove duplicate lines BEFORE you search for your last name. Why? (3) Find out how many lines there are in the output altogether. When you have found all this out, use vi to make a file called "RESULTS". On ONE LINE, separated by spaces, put these three numbers (from (1), (2) and (3) above). The numbers should be in THAT order (1 2 3) and NOTHING else should be on that line, other than the spaces that separate the numbers. ************************************************************* * Example: * here is a line with Whitlock in it * here is a line with Whitlock in it * akjflkajdslkjaslkjfasd as junk junk junk * akjdfasd Whitlock askjfasjfasdf * garbage garbage * Whitlock * Whitlock * Whitlock * * The above output has 8 lines in it but the second * and the last two are duplicate adjacent lines. So * for this output, my RESULTS file would contain * 6 3 8 ************************************************************* NOTE: You wil find the uniq command useful here. This command copies standard input to standard output (like cat) but, unlike cat, elminates duplicate adjacent lines. Type "man uniq" for more information about uniq. NOTE the x4 program takes A BIT OF TIME to execute. Be patient! Send the "RESULTS" file using toteach: toteach 4 RESULTS