Homework 6 – Awk

Due via ANGEL by 6pm on Sunday, November 11, 2012.

You will need access to a Unix (or Unix-like) system for this assignment. There is no requirement to use a particular system, or kind of system.

You will need to submit your name, student ID, your script, and the output described below.

Download and save a local copy of the file census.txt. This file contains data from the 2000 US census. The file is tab-delimited, and the fields are County name, population, water area (in square miles), land area (in square miles). This file covers the counties in Washington state.

Write an awk script that will parse the data, and for each county, print the county name, the population per square mile of land, and the percentage of the county that is water. (Note that the total area of the county is the sum of the land and water areas.)

At the end, your script should print the county name and the value for the following criteria.

·         Highest population density

·         Lowest population density

·         Highest percentage of water

·         Lowest percentage of water

So, for example, you might print out "Highest population density: Adams County, 9999 people/square mile"