Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mcvax!ukc!dcl-cs!stephen
From: stephen@comp.lancs.ac.uk (Stephen J. Muir)
Newsgroups: news.admin
Subject: deciding how much news to expire to free disk space
Message-ID: <143@dcl-csvax.comp.lancs.ac.uk>
Date: Sat, 10-Jan-87 03:32:11 EST
Article-I.D.: dcl-csva.143
Posted: Sat Jan 10 03:32:11 1987
Date-Received: Sun, 11-Jan-87 02:41:19 EST
Reply-To: stephen@comp.lancs.ac.uk (Stephen J. Muir)
Distribution: world
Organization: Department of Computing at Lancaster University, UK.
Lines: 31

Sometimes, when my spool area is in danger of filling up, I decide to do an
expire run with less than the default number of days.  The problem of how many
days worth of news to keep requires a time-consuming examination of the history
file.  So here is a wee awk script to print out the number of news articles
received on each date in the history file:
----------------------------------- Cut Here ----------------------------------
#! /bin/sh
exec awk '
BEGIN	{	FS = "\t"	}
	{	if ($3 == "" || $3 == "cancelled")
			break
		date = $2
		while (substr (date, 1, 1) == " ")
			date = substr (date, 2)
		date = substr (date, 1, 8)
		if (count [date] == 0)
			sort [++number] = date
		++count [date]
	}
END	{	for (i = 1; i <= number; ++i)
		{	date = sort [i]
			printf "%s %s\n", date, count [date]
		}
	}
' < /usr/lib/news/history
----------------------------------- Cut Here ----------------------------------
-- 
EMAIL:	stephen@comp.lancs.ac.uk	| Post: University of Lancaster,
UUCP:	...!mcvax!ukc!dcl-cs!stephen	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4120		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR