#!/bin/csh -bf # # SlipsByHour # # Script displays the number of new slips for each hour. # N.E. King # May 1996 Adapted from SlipsByStation # Initialize options # ------------------ set Stanam = none set Satnam = none set debug = no # Parse command line if there are arguments # ----------------------------------------- echo " " if ($#argv > 0) then set k = 1 while ($k <= $#argv) switch ($argv[$k]) case -sta: @ k++ set Stanam = $argv[$k] @ k++ breaksw case -sat: @ k++ set Satnam = $argv[$k] @ k++ breaksw case -debug: set debug = yes @ k++ breaksw case help: case -help: case -H: @ k++ more << EOF --------------------------------------------------------------------------- Usage: SlipsByHour [-sta STATION] [-sat SATELLITE] where -sta STATION Optional station, where STATION is 4-character code -sat SATELLITE Optional satellite gpsnn User may specify any combination (either, both, none) of these arguments --------------------------------------------------------------------------- EOF exit breaksw default: echo "Unrecognized argument $argv[$k]" more << EOF Usage: SlipsByHour [-sta STATION] [-sat SATELLITE] For more information type "SlipsByHour help" EOF exit breaksw endsw end endif # Check that postbreak.log exists # ------------------------------- if (-e postbreak.log) then else echo There is no file called postbreak.log in the working directory exit 1 endif # Save slips list in temporary file # --------------------------------- SlipsList > temp1.$$ # Do this block if optional station arg is given # ---------------------------------------------- if ($Stanam != none) then set Stanam = `echo $Stanam | sed '/.*/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` set statest = `grep $Stanam postfit.log | wc -l` if ($statest == 0) then echo Station $Stanam is not in this data set exit endif echo STATION $Stanam grep $Stanam temp1.$$ > temp2.$$ rm temp1.$$ mv temp2.$$ temp1.$$ endif # Do this block if optional satellite arg is given # ------------------------------------------------ if ($Satnam != none) then set Satnam = `echo $Satnam | sed '/.*/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` set sattest = `grep $Satnam postfit.log | wc -l` if ($sattest == 0) then echo Satellite $Satnam is not in this data set exit endif echo SATELLITE $Satnam grep $Satnam temp1.$$ > temp2.$$ rm temp1.$$ mv temp2.$$ temp1.$$ endif # Loop on hours # ------------- set hr = (00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23) echo "Hour New Slips" echo " " @ i = 1 while ($i <= 24) set numout = `grep " ${hr[$i]}:" temp1.$$ | wc -l` echo $hr[$i] $numout | awk '{printf("%-15s%11d\n",$1,$2)}' @ i = $i + 1 end set numout = `wc -l temp1.$$ | awk '{print $1}'` echo " " echo $numout | awk '{printf("%26d TOTAL \n",$1)}' # Clean up # -------- rm temp?.$$