#!/bin/sh

# Size of spool area in Kilobytes
prefix=/usr
CACHE_LOGDIR=`egrep '^LogDirectory' /etc/newscache.conf | cut -d ' ' -f 2`

if [ "X$1" != "X-" ]; then
cat $CACHE_LOGDIR/Trace-*
fi | \
awk '	BEGIN \
		{ cgroup=""; ctime=0 } \
	\
		{ ctime=ctime+1 } \
	tolower($6) == "group" && NF == 7 \
		{ cgroup=$7; next } \
	tolower($6) == "article" && NF == 7 \
		{ print ctime":\tarticle\t"cgroup" "$7; next } \
	$4 == "issue" && $5 == "article" && NF == 6 \
		{ print ctime":\tretr\t"cgroup" "$6; next } \
	$4 == "articlesize" && NF == 6 \
		{ gsub(":"," ",$5); print ctime":\tsize\t"$5" "$6; next } \
	$4 ~ "::setsize\\(" \
		{ gsub("[^,0-9]",""); gsub(","," "); print ctime":\tgroup\t"cgroup" "$3; next } \
	 \
		{ next }'
