[news.software.b] Another way to count news articles by date

geoff@desint.UUCP (Geoff Kuenning) (01/15/87)

>From: stephen@comp.lancs.ac.uk (Stephen J. Muir)
>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:

I liked the idea, but found the script slow.  Here's what I came up with:

    sed 's/[^\t]*\t\([A-Za-z]* *[0-9]*\).*/\1/' /usr/lib/news/history \
      | uniq -c

(for posting, I have replaced tabs with "\t".  You should turn them back
into tabs before trying the script out.
-- 

	Geoff Kuenning
	{hplabs,ihnp4}!trwrb!desint!geoff

shprentz@bdmrrr.bdm.com (Joel Shprentz) (01/16/87)

In article <286@desint.UUCP>, geoff@desint.UUCP (Geoff Kuenning) writes:
> > From: stephen@comp.lancs.ac.uk (Stephen J. Muir)
> > ...  So here is a wee awk script to print out the number of news articles
> > received on each date in the history file:
> 
> I liked the idea, but found the script slow.  Here's what I came up with:
> 
>     sed 's/[^\t]*\t\([A-Za-z]* *[0-9]*\).*/\1/' /usr/lib/news/history \
>       | uniq -c

I liked Geoff's improvement, but found it didn't work here.  I suspect it
is for an older style of history file.  Here is a similar script that
works for 2.11 history files.  As with Geoff's script, replace \t with
a tab (in two places) before running it.

sed  -e 's/[^\t]*\t *//' -e '/[a-z]/!d' -e '/cancelled/d' \
     -e 's/ .*//' /usr/lib/news/history  | uniq -c

-- 
Joel Shprentz                   Phone:  (703) 848-7305
BDM Corporation                 Uucp:  seismo!bdmrrr!shprentz
7915 Jones Branch Drive                shprentz@bdmrrr.bdm.com
McLean, Virginia  22102