topical media & game development

talk show tell print

basic-shell-app-a-exercise-07-05.sh / sh



  BEGIN { myformat="%-15s %3s %16s %11s %12s %12s\n"
          printf myformat,
                  "Country", "TLD", "Area in sq. km", \
                  "Population", "Land lines", "Cell phones"
          printf myformat,
                  "-------", "---", "--------------", \
                  "----------", "----------", "-----------" }
        { printf myformat,
                  $1, $2, $3, $4, $5, $6
          areatot += $3
          poptot += $4
          landtot += $5
          celltot += $6 }
  
  END { printf myformat,
                  "\nTotals:", NR, areatot, poptot, landtot, celltot "\n"  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.