#!/bin/csh
#
# captsignal.csh --> captures signal strength to stdout
#
# syntax:  ./runsignal.csh  >> DATA_FILE_NAME

loop:

  set timenow = `date +"%Y/%m/%d %H:%M:%S"`
  ./getsignal.exp > getsignal.log

  @ db  = `grep "Strength  In" getsignal.log | awk '{ print substr($4,1,3) }' | head -1 | tail -1`
  @ db += `grep "Strength  In" getsignal.log | awk '{ print substr($4,1,3) }' | head -2 | tail -1`
  @ db += `grep "Strength  In" getsignal.log | awk '{ print substr($4,1,3) }' | head -3 | tail -1`
  @ db += `grep "Strength  In" getsignal.log | awk '{ print substr($4,1,3) }' | head -4 | tail -1`
  @ db += `grep "Strength  In" getsignal.log | awk '{ print substr($4,1,3) }' | head -5 | tail -1`

  @ db /= 5

  echo $timenow"  "$db
  sleep 2

  goto loop

