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

Start poking around the data

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

2.
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.

3.
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
2000-02-14