Unix Text Analysis Tool
#signif shell script file searching tool
#This is the default
# signif.sh
#!/bin/sh
#set -x
# make sure that there are atleast two args to the command
case $# in
0) echo usage:;
echo " " `basename $0` keyphrase files
exit ;;
1) echo usage:;
echo " " `basename $0` keyphrase files
exit ;;
esac
if egrep -n $* /dev/null
then
context.sh $*
else
echo Sorry
fi
#Following is the script for the context file
#context.sh
#!/bin/sh
# create context file to go with signif
awkfile=/tmp/nu.awk.$$
case $# in
0) echo usage:;
echo " " `basename $0` keyphrase files
exit ;;
1) echo usage:;
echo " " `basename $0` keyphrase files
exit ;;
esac
cat >${awkfile} < 5 {print "sed -n ' " \$2-5 "," \$2+5"p'",\$1}
\$2 < 6 && \$2 > 1 {print "sed -n '" 2 "," \$2+5 "p'" , \$1}
{print "echo =============================="}
END_AWK_SCRIPT
#echo executing:
#echo " egrep -n ${key} $* | awk -f ${awkfile} | sh"
egrep -n $* /dev/null | awk -f ${awkfile} | sh
/bin/rm -f ${awkfile}