Tutorial #10 - Sorting lines based on field contents


1. Log on to UNIX if needed.

2. List forsorting on the screen.  Sort it in order of the first names.

3. Sort it in order by last name.

4. Sort the file in numeric sequence by the first field.

5. Sort your keep.home file in order by time of day.  (Use +7; don't 

use the -n option)

6.Try more sorts if you like.  Try a reverse one.  Try combining two 

similarly organized files into a single sorted output file.  Use cat to 

create a new file using another character besides space to separate 

the fields, and then sort that new file with the -tx  option.


If it doesn't work:

A. Try a simple sort with no options, just redirection.  Add one option 
at a time, starting with -o to name an output file. 

B.If a sort doesn't seem to produce the sequence you expect, try again.  
Check your options and try them on the same input one at a time until 
you spot the problem.

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