# setup commands for first terminal session
if (-e $home/.newsrc) then
   echo Copying .newsrc to .newsrc.bak. If anything goes wrong, you  can
   echo copy this file back to .newsrc. 
   cp $home/.newsrc .newsrc.bak
endif
set JOBID = $$

# Rearrange order of newsgroups in .newsrc
echo Rearranging order of newsgroups...
grep '^local.' .newsrc > $JOBID.local
grep -v '^local.' .newsrc > $JOBID.temp1
grep '^man.' $JOBID.temp1 > $JOBID.man
grep -v '^man.' $JOBID.temp1 > $JOBID.temp2
grep ^bionet $JOBID.temp2 > $JOBID.bionet 
grep -v ^bionet $JOBID.temp2 > $JOBID.temp3
cat $JOBID.local $JOBID.man $JOBID.bionet $JOBID.temp3 > $JOBID.newsrc 

echo Your .newsrc file has been rearranged so that newsgroups appear
echo in the following order:
echo "    local   - U. of M. newsgroups"
echo "    man     - Manitoba newsgroups"
echo "    bionet  - BIONET (biology) newsgroups"
echo "    other   - all other newsgroups"

#Unsuscribe user from all newsgroups
tr \: \! < $JOBID.newsrc > .newsrc 

# Print explanatory messages.
echo
echo "Your are currently UNSUSCRIBED to all newsgroups."
echo 'There are two ways to subscribe to newsgroups:'
echo '1) Edit your .newsrc file, and change exclamation marks (\!)'
echo '   to colons (:) for those newsgroups to which you wish to subscribe.'
echo
echo '2) Subscribe to each newsgoup from within your newsreader.'
echo '   eg. in rn, type 'g bionet.general' to go to bionet.general.'
echo
echo  'Remember, your original .newsrc file has been saved to .newsrc.bak.'

/usr/bin/rm $JOBID.*
  
