home *** CD-ROM | disk | FTP | other *** search
- BEGIN {
- FS = /{_w}[\#\(\)]{_w}*/;
- US = "US";
- Canada = "Canada";
- Europe = "Europe";
- Abbrev = 1;
- Capital = 2;
- Area = 3;
- Pop = 4;
- }
-
- {
- if ( $1 == Europe ) csp[$1][$NF][Abbrev] = FALSE;
- else csp[$1][$NF][Abbrev] = $4;
- csp[$1][$NF][Capital] = $(NF - 1);
- csp[$1][$NF][Area] = $2;
- csp[$1][$NF][Pop] = $3;
- }
-
- FINAL {
- for ( Country in csp ) {
- for ( State in csp[Country] ) {
- Ab = csp[Country][State][Abbrev];
- Ab = Ab ? Ab : "";
- print Country" : "State" ("Ab")";
- print csp[Country][State][Capital]" : "((1000 * csp[Country][State][Pop])/csp[Country][State][Area]);
- print "";
- }
- print "";
- }
- }
-