fred@umcp-cs.UUCP (08/20/83)
This shell script produces a list of all net.whatnot newsgroups, sorted by decreasing number of subscribers on your machine, with the readership for each. To extract it, run the rest of this news item through the shell. : 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' 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 644 subscribers /bin/echo -n ' '; /bin/ls -ld subscribers fi