home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / musbus / part01 / Adjust next >
Encoding:
Text File  |  1987-09-16  |  764 b   |  30 lines

  1. #! /bin/sh
  2. # $Header: Adjust,v 1.2 87/06/23 15:05:56 kjmcdonell Beta $
  3. if test $# -lt 1
  4. then
  5.     echo Usage: $0 logfile ...
  6.     exit 1
  7. fi
  8. for f
  9. do
  10.     awk '
  11. /sqrt/             { print $0; flag=0; state=0; next }
  12. /Arith/ && /arithoh/ { state=1; print $0; next }
  13. /Elapse/ && state==1 { state=2; e=$3; print $0; next }
  14. /CPU/ && state==2    { state=3; c=$3; print $0; next }
  15. /Arith/ && state==3  { flag=1; print $0; next }
  16. /Elapse/ && flag==1 && !/\(Actual/  { printf "%s (Actual: %.2f )\n",$0,$3-e; next }
  17. /CPU/ && flag==1 && !/\(Actual/     { printf "%s (Actual: %.2f )\n",$0,$3-c; next }
  18.              { flag=0; print $0 }
  19.     ' $f > /tmp/Adj$$
  20.     if cmp $f /tmp/Adj$$ >/dev/null
  21.     then
  22.         echo No changes made.
  23.     else
  24.         chmod u+w $f
  25.         cp /tmp/Adj$$ $f
  26.         chmod u-w $f
  27.     fi
  28.     rm -f /tmp/Adj$$
  29. done
  30.