topical media & game development

talk show tell print

basic-unix-16.txt / txt



  Chapter 16
  --------------------------------------
  
  /^ *[0-9]/ {
  trottime = 0; attempts = 0;
  for (field = 5; field <= NF; ++field) {
  if (field == “ms”) {
  trottime = $(field - 1) + trottime
  attempts = attempts + 1
  }
  }
  if (attempts > 0) {
  average = trottime/attempts
  printf “Point: “ $2 “, Average Latency: “ average “\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.