Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utcsrgv.UUCP Path: utzoo!utcsrgv!oscar From: oscar@utcsrgv.UUCP (Oscar M. Nierstrasz) Newsgroups: net.sources Subject: Newsgroup peruser (shell script) Message-ID: <3842@utcsrgv.UUCP> Date: Wed, 11-Apr-84 16:50:32 EST Article-I.D.: utcsrgv.3842 Posted: Wed Apr 11 16:50:32 1984 Date-Received: Wed, 11-Apr-84 17:25:37 EST Organization: CSRG, University of Toronto Lines: 69 Here is a (Bourne) shell script for perusing newsgroups that you don't normally read. It compiles a list of subject headings for all unread articles starting from the last one you read. With the -a flag, all articles are listed (done automatically if last-read article has expired). Arguments are newsgroups (eg: `ns net.sources'). The output could conceivably be edited into shell script that selects the articles you're interested in ... Enjoy! ------------------------- cut here ---------------------- #! /bin/sh # ns [-a] newsgroups ... # List subject headings of articles in listed newsgroups # starting at last-read article in .newsrc. # With the -a flag all articles are listed. # Author : Oscar Nierstrasz @ utcsrgv!oscar case $# in 0 ) echo 'Usage: ns [-a] ...' 1>&2 exit ;; esac nrc=$HOME/.newsrc if test ! -r $nrc then echo "ns : Can't find $nrc" 1>&2 exit fi n=/usr/spool/news s='/^Subject:/ { print FILENAME ": " $0 ; exit }' case $1 in -a ) all=y shift ;; * ) all=n ;; esac for i do d=`echo $i | sed "s/\./\//g"` if test ! -d $n/$d then echo "$i : no such newsgroup" 1>&2 else cd $n/$d echo echo "--- $i : $n/$d ----" echo case $all in y ) f=all ;; n ) f=`sed -n "/^$i:/s/.*-//p" $nrc` case $f in "" ) f=all ;; * ) if test ! -r $f then f=all fi ;; esac ;; esac case $f in all ) for j in * do awk "$s" $j done ;; * ) while test -r $f do awk "$s" $f f=`expr $f + 1` done ;; esac fi done