#!/bin/sh # # 1) Removes the numbers in a .newsrc file # 2) Subscribes to all newsgroups in a 'nngrep' file # newsrc=~/.newsrc if [ $# -ne 0 ]; then newsrc=$1 fi p=$(basename $0) tmpfile=$(mktemp ~/$p.XXXXXX) || exit 1 sed -E -e '/^options /{p;d;}' -e 's/(:|!).*$/\1 /' -e 's/([^ ])$/\1: /' $newsrc >$tmpfile || { rm -f $tmpfile; exit 1; } mv -f $tmpfile $newsrc .