* Topics covered: processing columnar data
* Utilities covered: awk
* The awk utility is used for processing columns of data
* A simple example shows how to extract column 5 (the file size)
from the output of ls -l
ls -l | awk '{print $5}'
* Cut and paste this line into a Bourne shell and you should see a
column of file sizes, one per file in your current directory.
* A more complicated example shows how to sum the file sizes and
print the result at the end of the awk run
ls -al | awk '{sum = sum + $5} END {print sum}'
* In this example you should see printed just one number, which is
the sum of the file sizes in the current directory.