Tutorial #9 - Basic Pipes and Filters
1. Log on to UNIX if needed.
2. Use tee to send a long listing of your home directory to
keep.home . Generate another extended listing and append it to
the same file. Examine keep.home on the screen.
3.Create a long listing on the screen and pipe it to the printer.
4. Use sort to arrange four or five words you type at the keyboard
in order on the screen. Try it again to produce a sorted file of six
or seven names; call it sort.names. Examine sort.names on the
screen.
5. Sort keep.home to the screen. Notice that it is sorted by the
entire line, beginning with the access permissions, rather than by
the file names. Sort it again by file name and store the result in
sorted.keep.
6.Use cat > forsorting to create a file containing these lines:
8 Michael McMahan
12 Charles Martin
9 Rachael Ashcroft
6 Julie Ferndale
4 (any name)
10 (any name)
7.Sort forsorting to the screen. Note that the lines that start with
10 and 12 are first, before the one that starts with 4; this is ASCII
sequencing order. Save this file; you'll use it again in the next
tutorial
If it doesn't work:
A. If you have trouble with tee, try a simple example, such as
ls | tee hold.dir to see if it works (Use cat hold.dir to see the
contents).
B. Try accomplishing the effect with a series of separate commands
and simple redirection; remember to use < for input and > for
output.
Questions? Robert Katz:rkatz@ned.highline.edu
Last Update July 16, 2002