[news.sysadmin] netnews cancer surgeon

romain@pyrnj.uucp (Romain Kang) (10/11/88)

For those of you who don't yet have an automated procedure to get rid
of the 5000-odd articles your site may have already received, here's
my hack:

#! /bin/sh
#
# Side effect: creats rm-stdin in SPOOLDIR
#
PATH=/bin:/usr/bin:
LIBDIR=/usr/lib/news
HISTORY=$LIBDIR/history
SPOOLDIR=/usr/spool/news
#GREP=/usr/local/bin/bm
GREP=egrep

cd $SPOOLDIR

if [ ! -f rm-stdin ]; then
cat >> rm-stdin.c << 'EoF'
main() {
	char in[128];
	while (gets(in)) { if (unlink(in) < 0) perror(in); }
}
EoF
	cc -o rm-stdin rm-stdin.c
fi

# "microsoft\t25144"
$GREP "microsoft	25144" $HISTORY |
sed -n -e '/	$/d' -e 's/.*	\(.*\) *$/\1/' -e 's/ $//' \
	-e 's/\./\//gp'			|
./rm-stdin