1#!/bin/sh
2#
3# uuspeed - a script to parse a Taylor UUCP Stats file into pretty results.
4# Zacharias J. Beckman.
5#
6# Modified 20/12/96 by Mark Horsburgh (markh@kcbbs.gen.nz) to calculate
7# correct average transmission rate and to give bytes/s rather than baud
8# (since baud is not really the correct name for it and bits/s actually
9# depends on the number of start and stop bits etc)
10
11grep bytes /usr/spool/uucp/Stats | grep -v 'bytes 0.00 secs' | grep -v 'failed after' | tail -80 | \
12gawk '
13  BEGIN {
14    printf("          UUCP transmission history:\n");
15    format=" %8d bytes %8s(%8s) in %7.2f sec = %5.0f bytes/s, %5.1fK / min\n";
16    bytes = 0.0
17    seconds = 0.0
18  }
19
20  {
21  if ($6 > 100) {
22      printf (format, $6, $5, $2, $9, $6/$9, ($6/$9*60)/1024);
23
24      bytes += $6
25      seconds += $9
26    }
27  }
28
29  END {
30    printf ("          average speed %5.0f bytes/s, %4.1fK/min\n",
31	bytes/seconds,bytes/seconds*60/1024);
32  }
33'
34