1# nngrab -- quick news retrieval by keyword 2# 3# From: James A. Woods (ames!jaw), NASA Ames Research Center 4# 5# Naturally, you're running fast e?grep (GNU-style) or this is all for 6# naught. 7 8 9FOLDCASE="" 10case $1 in 11-c) 12 FOLDCASE="-i" 13 shift 14esac 15 16case $# in 171) ;; 18*) 19 echo >&2 "usage: $0 [-c] keyword-pattern" 20 exit 1 21esac 22 23case $1 in 24*[A-Z]*) KW="`echo "$1" | tr '[A-Z]' '[a-z]'`";; 25*) KW=$1 26esac 27 28if [ -s $DB/subjects ] ; then 29 groups=` 30 egrep "^[^:]*:.*${KW}" $DB/subjects | 31 sed 's/:.*//' | 32 uniq 33 ` 34 35 case $groups in 36 '') 37 echo >&2 "Pattern '$1' not found in any subjects" 38 exit 1 39 esac 40 41 groups="-G $groups" 42else 43 groups=all 44fi 45 46exec $BIN/nn -Q -mxX $FOLDCASE -s/"$1" $groups 47