How to find which newsgroups are being read.
Fred Blonder
fred at gymble.UUCP
Fri Feb 8 07:06:30 AEST 1985
From: avolio at grendel.UUCP (Frederick M. Avolio)
Somewhere, I saw a question asking whether it was
possible to determine what news on a site is actually
being read. I would love to be able to find out that
there are only 12-18 newsgroups actually used by my
people. . . .
Fred Blonder at umcp-cs wrote a subscriber shell -- reports how
many subscribers each news group has by looking at everyone's
.newsrc file. . . . Don't tell him I sent you.
- Fred Avolio {decvax,seismo}!grendel!avolio
In anticipation of the flood of requests ( ;-) ) for this script, I'll post
it. It tells which groups are subscribed to, not which ones are actively
read, which is what you REALLY want.
<> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <>
: Run this shell script with "sh" not "csh"
PATH=:/bin:/usr/bin:/usr/ucb
export PATH
all=FALSE
if [ $1x = -ax ]; then
all=TRUE
fi
/bin/echo 'Extracting subscribers.6l'
sed 's/^X//' <<'//go.sysin dd *' >subscribers.6l
X.TH SUBSCRIBERS 6L "3-Oct-83 (U of Maryland)"
X.SH NAME
subscribers \- list how many people subscribe to each newsgroup
X.SH SYNOPSIS
X.I subscribers
X.SH DESCRIPTION
X.I Subscribers
is a short shell script which looks into the password file, and everyone's
$HOME/.newsrc file, to find out how many people subscribe to each newsgroup.
The resulting list is written to the standard output as a series of lines of
the form:
X.sp
X.ti +10
newsgroupname number-of-subscribers
X.sp
sorted by decreasing number of subscribers.
X.SH AUTHOR
Fred Blonder <fred at umcp-cs>
X.SH FILES
X.in +15
X.ti -15
X/etc/passwd \- to find all login directories.
X.br
X.ti -15
$HOME/.newsrc \- (for each entry in /etc/passwd) to find each individual
user's subscription list
X.in -15
X.SH "SEE ALSO"
readnews(1), news(5)
X.SH DIAGNOSTICS
None.
X.SH BUGS
Doesn't take into account multiple accounts using the same login directory,
or people who change their $HOME directory.
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 subscribers.6l
/bin/echo -n ' '; /bin/ls -ld subscribers.6l
fi
/bin/echo 'Extracting subscribers.sh'
sed 's/^X//' <<'//go.sysin dd *' >subscribers.sh
#! /bin/sh
#
# @(#)subscribers.sh (University of Maryland) Fred Blonder 19-Aug-1983
#
# Find out how many people subscribe to each newsgroup
sub_tmp=/tmp/#s.$$
trap "rm -f $sub_tmp" 0 1 2 15
for dir in `awk -F: '{ print $6 }' /etc/passwd | sort -u`
do # locate all login directories
if # if .newsrc exists
[ -r $dir/.newsrc ]
then # find all newsgroups subscribed to, append to $sub_tmp
awk -F: '/^net\..*: [0-9].*$/ { print $1 }' \
$dir/.newsrc >> $sub_tmp
fi
done
# Count all ocurrences of all newsgroups.
# Print result sorted by decreasing number of subscribers.
awk '{ x[$1] = x[$1] + 1 } \
END { for (i in x) print i " " x[i] }' $sub_tmp | sort +1 -rn
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 555 subscribers.sh
/bin/echo -n ' '; /bin/ls -ld subscribers.sh
fi
--
Fred Blonder (301) 454-7690
Fred at Maryland.{ARPA,CSNet}
harpo!seismo!umcp-cs!fred
More information about the Comp.sources.unix
mailing list