[net.sources] uucp dialing percentages

dennis@sys1.UUCP (12/17/84)

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])
}