john@beaudin.UUCP (John Beaudin) (07/21/90)
I happen to call the script 'ucount'. The directory where 'ucount' resides should replace the '$bin' below: #!/bin/sh # This is a shell archive (shar 3.32) # made 07/21/1990 16:10 UTC by root@beaudin # Source directory /u/bin # # existing files WILL be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 60 -rwxr-xr-x ucount # 393 -rwxr-xr-x ucount.awk # 180 -rw-r--r-- ucount.out # if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= ucount ============== echo "x - extracting ucount (Text)" sed 's/^X//' << 'SHAR_EOF' > ucount && Xawk -f /u/bin/ucount.awk </usr/spool/uucp/.Admin/xferstats SHAR_EOF $TOUCH -am 0721113190 ucount && chmod 0755 ucount || echo "restore of ucount failed" set `wc -c ucount`;Wc_c=$1 if test "$Wc_c" != "60"; then echo original size 60, current size $Wc_c fi # ============= ucount.awk ============== echo "x - extracting ucount.awk (Text)" sed 's/^X//' << 'SHAR_EOF' > ucount.awk && X { i = index( $1, "!" ) X node = substr( $1, 1, i-1 ) X bytes[node] += $7 X ++files[node] X } XEND { for ( node in bytes ) X { printf( "%7s = %8d bytes %4d files\n", X node, bytes[node], files[node] ) X total_bytes += bytes[node] X total_files += files[node] X } X printf( "-----------------------------------\n" ) X printf( " total = %8d bytes %4d files\n", total_bytes, total_files ) X } SHAR_EOF $TOUCH -am 0721112890 ucount.awk && chmod 0755 ucount.awk || echo "restore of ucount.awk failed" set `wc -c ucount.awk`;Wc_c=$1 if test "$Wc_c" != "393"; then echo original size 393, current size $Wc_c fi # ============= ucount.out ============== echo "x - extracting ucount.out (Text)" sed 's/^X//' << 'SHAR_EOF' > ucount.out && X tmsoft = 2517688 bytes 34 files Xbmbcomp = 485502 bytes 40 files Xcompuge = 54599 bytes 6 files X----------------------------------- X total = 3057789 bytes 80 files SHAR_EOF $TOUCH -am 0721120890 ucount.out && chmod 0644 ucount.out || echo "restore of ucount.out failed" set `wc -c ucount.out`;Wc_c=$1 if test "$Wc_c" != "180"; then echo original size 180, current size $Wc_c fi exit 0 -- My .signature is awaiting apropriate display technology