uucp dialing percentages
dennis at sys1.UUCP
dennis at sys1.UUCP
Mon Dec 17 16:11:00 AEST 1984
Here is the awk script that does not need pedz's awk mods.
By the way this how you get around not having the * in
your printf statment.
------------------------------------------------------------
#
# Awk program to gather dialing statistics from uucp's
# LOGFILE and print the percentage of successfull, failed
# and locked attempts for each site.
#
# Keys off of the "(call to xxx )" line in the LOGFILE
#
$5 == "(call" && $6 == "to" { #get call line, $4 is status, $7 is system
if (TOTAL[$7] == 0 && maxlength < length($7))
maxlength = length($7)
TOTAL[$7]++
if ($4 == "SUCCEEDED")
SUCCEEDED[$7]++
else if ($4 == "FAILED")
FAILED[$7]++
else if ($4 == "LOCKED")
LOCKED[$7]++
else
printf("%s is an unknown field", $4)
}
END {
maxlength = maxlength + 2
format=sprintf(" %%%dsSUCCEEDED FAILED LOCKED\n", maxlength)
printf(format, " ")
for (name in TOTAL)
format=sprintf("%%s:%%%ds%%9.2f %%9.2f %%9.2f\n",\
maxlength - length(name))
printf(format, name, " ", \
100.0 * SUCCEEDED[name] / TOTAL[name], \
100.0 * FAILED[name] / TOTAL[name], \
100.0 * LOCKED[name] / TOTAL[name])
}
More information about the Comp.sources.unix
mailing list