UNIX Filters

What is this?

You can think of a UNIX filter as a biological creature. It has three important components: a mouth (standard input), a cloaca (standard output), and an alimentary canal that connects the two. It hoovers up data in its mouth, transforms it in the alimentary canal, and excretes it via it cloaca.

Here is an exmple. The program cat puts a file to the screen. You just say cat some_file and the contents of the file are put to the screen. When you give it a file that file goes in its "mouth" and it by default goes to the screen (the place it gets deposited). This filter actually doesn't filter at all! You can even cat an entire glob of files.

Another is grep, which examines a file line by line and prints out all the lines containing a string you give it as an argument.

These filters can be chained together using the pipe mechanism and the output can easily be dumped into a file. You can use a single file or a whole glob of files as input.


The prerequisite to this workshop is the workshop on the file system and the BASH shell.

Participants will also get a PDF text which addresses the topics shown below.