next up previous
Next: Use gnuplot to plot Up: Homework 2: Caching Previous: Get the program and

Start poking around the data

Use more, vi or emacs to read the data file.

You can use awk to extract particular lines from the file. For example:

     awk '$2 == 4096' < data

will print only the lines where the second column is 4096.

     awk '$2 == 4096 {print $4}' < data

selects the same lines as the previous command, but instead of printing the whole line, it only prints the fourth column.

You can pipe the output of one command into another. For example

     awk '$2 == 4096 {print $4}' < data | wc

Counts the number of lines (and words and characters) that have 4096 in the second column.

Allen Downey