Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site sys1.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!inuxc!pur-ee!uiucdcs!sys1!dennis
From: dennis@sys1.UUCP
Newsgroups: net.sources
Subject: Re: uucp dialing percentages
Message-ID: <-1056446@sys1.UUCP>
Date: Mon, 17-Dec-84 01:11:00 EST
Article-I.D.: sys1.-1056446
Posted: Mon Dec 17 01:11:00 1984
Date-Received: Fri, 21-Dec-84 02:01:51 EST
References: <17600005@smu.UUCP>
Lines: 39
Nf-ID: #R:smu:17600005:sys1:-1056446:000:1220
Nf-From: sys1!dennis    Dec 17 00:11:00 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])
}