home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / qtawk / state.exp < prev    next >
Text File  |  1989-11-25  |  706b  |  32 lines

  1. BEGIN {
  2.     FS = /{_w}[\#\(\)]{_w}*/;
  3.     US = "US";
  4.     Canada = "Canada";
  5.     Europe = "Europe";
  6.     Abbrev = 1;
  7.     Capital = 2;
  8.     Area = 3;
  9.     Pop = 4;
  10. }
  11.  
  12.     {
  13.     if ( $1 == Europe ) csp[$1][$NF][Abbrev] = FALSE;
  14.       else csp[$1][$NF][Abbrev] = $4;
  15.     csp[$1][$NF][Capital] = $(NF - 1);
  16.     csp[$1][$NF][Area] = $2;
  17.     csp[$1][$NF][Pop] = $3;
  18. }
  19.  
  20. FINAL {
  21.     for ( Country in csp ) {
  22.     for ( State in csp[Country] ) {
  23.         Ab = csp[Country][State][Abbrev];
  24.         Ab = Ab ? Ab : "";
  25.         print Country" : "State" ("Ab")";
  26.         print csp[Country][State][Capital]" : "((1000 * csp[Country][State][Pop])/csp[Country][State][Area]);
  27.         print "";
  28.     }
  29.     print "";
  30.     }
  31. }
  32.