Macro for Somewhat Better "=" (list subjects) in rn newsreader

Dan Jacobson danj1 at cbnewse.ATT.COM
Wed May 2 08:02:24 AEST 1990


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# 
# Wrapped by danj1 on Tue May  1 17:02:28 CDT 1990
# Contents:  ...subjects
 
echo x - ...subjects
sed 's/^@//' > "...subjects" <<'@//E*O*F ...subjects//'
: Dan_Jacobson at ATT.COM 5/1990

# A semi-stupid quick'n'dirty UNIX netnews subject gatherer for inside
# rn, because rn's "=" isn't good enough.  Gives the count, in
# descending order, of each subject in a newsgroup.  This program
# takes a few seconds to run. It also doesn't look in your .newsrc
# file, so it just lists all subjects, read and unread. Sample output
# [while in newsgroup soc.singles]:

#   32 is monogamy passe?
#   16 bathroom needs (was: meeting women)
#   15 isis position paper on homosexuality
# etc.

# [I bet I'm not the first to make this macro/program, and is there a
# new release of rn that does it?]  It is called by an rn macro so
# that it executes in the newsgroup's spool directory, which I assume
# you have access to (e.g., probably not accessible if you're running
# rrn).  Lists all subjects, read and unread.  To bind this to ":",
# put this line in your .rnmac file (with the ":" the first thing on
# the line):

#         : %(%m=[nap]?%(%m=n?.)!!...subjects^j)

# and call this file [that you are reading] "...subjects" and put it
# in your UNIX $PATH.

test -z "$PAGER" && PAGER="eval echo; cat"
#echo: else output looks ugly when called from newsgroup selection level.

W='[ 	][ 	]*' #white space
sed "
	/^Subject/!d
	s/$W$//
	s/$W/ /g
	s/ [Rr][Ee]: / /g
	s/ [Rr][Ee]^2: / /g
	s/ [Rr][Ee] / /g
	s/Subject: //g
	y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm/
	" * | sort | uniq -c | sort -nr | $PAGER
@//E*O*F ...subjects//
chmod u=rwx,g=rx,o=rx ...subjects
 
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     41    252   1454 ...subjects
!!!
wc  ...subjects | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0



More information about the Alt.sources mailing list