Tutorial #11 - Other Filter Commands


1. Log on to UNIX if needed.

2. Check the file type of each file in your directory using file.

3. Create a file named forexercise containing the lines shown 

below:

	7	Sylvia Jones
	6	Caroline Gomez
	3	Alfred Gomez
	2	Colonel Sanders
	9	Vivian Buford
	9	Vivian Buford
	5	Mitch Severance
	6	Caroline Gomez
	3	Alfred Gomez

4. Check the number of lines, words, and characters in forsorting 

and forexercise.  Then check just the number of lines.

5. Check the unique lines in forexercise (You should get 8).

6.Sort forexercise and store it as forexer.sorted.  Now how many 

unique lines are there in forexer.sorted ?  Check the number of 

unique lines based on the third field, just for fun.

7. How many lines occur in both forsorting and forexer.sorted?  

(First sort forsorting and put the result into sorted.lines, and then 

use the comm command on the two sorted files.)

8. Check the differences between the two sorted files, just to see 

what the output looks like.


If it doesn't work:

A. You won't have to use many options of the uniq, comm, diff 
commands here; feel free to experiment if you want. 

B.If you typed your files a bit differently from the ones in this 
example, you may get different answers.  A long as you 
understand the output you get, don't worry about it.

C.In this example, the files have four lines that appear only in 
sorted.lines, six lines that appear in forexer.sorted and two in 
common between the two.

Questions? Robert Katz:rkatz@ned.highline.edu
Last Update July 23, 2002