Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site dciem.UUCP Path: utzoo!dciem!ntt From: ntt@dciem.UUCP (Mark Brader) Newsgroups: net.news Subject: Bourne Shell script to resubscribe (or unsubscribe) to newsgroups Message-ID: <811@dciem.UUCP> Date: Tue, 27-Mar-84 17:24:09 EST Article-I.D.: dciem.811 Posted: Tue Mar 27 17:24:09 1984 Date-Received: Tue, 27-Mar-84 20:50:42 EST Organization: NTT Systems Inc., Toronto, Canada Lines: 27 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