AWK (for Aho, Weinberger, and Kernighan) is a versatile data filter that is often used to re-format data, and to produce reports and summaries. It is one of the most powerful of the standard filter commands. For this project you will write an AWK script to print the population per square mile for each country in Europe, and when done print the total population of Europe.
The source data comes from the file
$HOME/countrys.dat
, whose format is:
Country_Name Area Population Continent
The Area is shown in thousands of square miles, and the Population is shown in millions of people. (So you will need to do some conversions.) The four fields are separated with one tab between fields.
This file may be copied from ~wpollock/countrys.dat
,
or you can download countrys.dat.
When run, the script's output should looks similar to this:
Country People per in Europe Square Mile --------- ------------- Austria 250.00 France 265.06 Germany 586.96 United Kingdom 680.85 Total population of Europe: 219 million
~/bin
to hold your shell scripts.
(This directory should already be on your PATH
.)
A copy of your script as email.
You can use the script
command to record your work and the results of running
your scripts.
Feel free to “clean-up” the transcript
file
before you submit it.
(Remove the results of running vi
(but not the vi
command line), and any typos.)
You can type or send as email to . Please use the subject similar to “Shell Scripting Project (awk) Submission”, so I can tell which emails are submitted projects.
Send questions about the assignment to . Please use a subject similar to “Shell Scripting Project (awk) Question” so I can tell which emails are questions about the assignment (and not submissions).
Please see your syllabus for more information about submitting projects.