home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / scripts / stat.awk < prev   
Encoding:
AWK Script  |  1978-03-06  |  1007 b   |  33 lines

  1. BEGIN {
  2.     file=ENVIRON["HOME"] "/Mail/jobs";
  3.  
  4.     while ((getline < file) > 0)
  5.     {
  6.     if (match($0,/[a-zA-Z_]+[0-9]+ (WORK|DONE|FREE)/))
  7.     {
  8.         jobs ++;
  9.         if ($2 == "WORK") work ++;
  10.         else if ($2 == "DONE") done ++;
  11.         else free ++;
  12.     }
  13.     if (match($0,/[a-zA-Z_]+ (WORK|DONE|FREE)/))
  14.     {
  15.         ojobs ++;
  16.         if ($2 == "WORK") owork ++;
  17.         else if ($2 == "DONE") odone ++;
  18.         else ofree ++;
  19.     }
  20.     }
  21.  
  22.     print "There is a total of " jobs " functions."
  23.     printf ("%4d (%7.2f%%) are still todo\n",        free, free*100.0/jobs);
  24.     printf ("%4d (%7.2f%%) are currently in work\n", work, work*100.0/jobs);
  25.     printf ("%4d (%7.2f%%) are completed\n",         done, done*100.0/jobs);
  26.     print ""
  27.     print "There is a total of " ojobs " other things."
  28.     printf ("%4d (%7.2f%%) are still todo\n",        ofree, ofree*100.0/ojobs);
  29.     printf ("%4d (%7.2f%%) are currently in work\n", owork, owork*100.0/ojobs);
  30.     printf ("%4d (%7.2f%%) are completed\n",         odone, odone*100.0/ojobs);
  31. }
  32.  
  33.