uutot.awk—Report UUCP Statistics
Contributed by Roger A. Cornelius
Here’s something I wrote in nawk in response to all the C versions of the same thing which were posted to alt.sources awhile back. Basically, it summarizes statistics of uucp connections (connect time, throughput, files transmitted, etc.). It only supports HDB-style log files, but will show statistics on a site-by-site, or on an overall (all sites), basis. [It also works with /usr/spool/uucp/SYSLOG.]
I use a shell wrapper which calls “awk -f” to run this, but it’s not necessary. Usage information is in the header. (Sorry about the lack of comments.)
# @(#) uutot.awk - display uucp statistics - requires new awk # @(#) Usage:awk -f uutot.awk [site ...] /usr/spool/uucp/.Admin/xferstats # Author: Roger A. Cornelius (rac@sherpa.uucp) # dosome[]; # site names to work for - all if not set # remote[]; # array of site names # bytes[]; # bytes xmitted by site # time[]; # time spent by site # files[]; # files xmitted by site BEGIN { doall = 1; if (ARGC > 2) { doall = 0; for (i = 1; i < ARGC-1; i++) { dosome[ ARGV[i] ]; ARGV[i] = ""; } } kbyte = 1024 # 1000 if you're not picky bang = "!"; sending = "->"; xmitting = "->" "|" "<-"; hdr1 = "Remote K-Bytes K-Bytes K-Bytes " \ "Hr:Mn:Sc Hr:Mn:Sc AvCPS AvCPS # #\n"; hdr2 = "SiteName Recv Xmit Total " \ "Recv Xmit Recv Xmit Recv Xmit\n"; hdr3 = "-------- --------- --------- --------- -------- " \ "-------- ----- ----- ---- ----"; fmt1 = "%-8.8s %9.3f %9.3f %9.3f %2d:%02d:%02.0f " \ "%2d:%02d:%02.0f ...
Get sed & awk, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.