[net.news] Bourne Shell script to resubscribe

ntt@dciem.UUCP (Mark Brader) (03/28/84)

There was a request a few days ago for a way to resubscribe to a group
that you've unsubscribed from.  I've lost the original posting, so this
may not be in the same group, but here's what I use (comments follow):

case `basename "$0"` in
	ss)	C=":";;
	*)	C="!";;
esac
SEDCMD=`echo $* | sed 's#[^ ][^ ]*#-e "/^&[:!]/s/[:!]/$C/w /dev/tty"#g'`
TMP=/tmp/rc$$
trap "rm $TMP" 2
eval "sed $SEDCMD <${NEWSRC=$HOME/.newsrc} >$TMP"
mv $TMP $NEWSRC

The above script is in a file linked as both "ss" and "us", for "subscribe"
and "unsubscribe" respectively.  The first 4 lines decide which you called.
The rest constructs a sed command and modifies your .newsrc (or $NEWSRC, if
defined) file as desired.  Matched lines are echoed to /dev/tty; if you don't
like this verbosity, remove      w /dev/tty      from line 5.

You can give several group names, and can give sed patterns (must match the
whole group name), as in:     us net.news.* .*.general
But remember to use sed-type patterns (.* to match anything, not *).

It works here, anyway -- V7 and news B2.10.1.

Mark Brader