(draft)
SIGNIF
signif - research tool
SYNOPSIS
signif [-l] [-c] [-w] [-a] [-k] [-p] [-f]
signif [ ] [ ] pattern filename[s]
AVAILABILITY
(see Appendix)
DESCRIPTION
signif (to help researchers navigate through their data)
is a research tool based on grep, sed and awk. It makes it possible
to use the computer as an intellectual aid to help a researcher
determine what is significant in a collection of data. This command allows for
input in the form of a linguistic pattern and produces a list of file
names, line numbers and lines from the files containing the linguistic
pattern and/or the multiple line context of the pattern. The tool makes it
possible to output the context of the keyword or expression (printing 5 lines
before and after the line containing the pattern). And the entire
file that the pattern was found in can also be printed.
This tool makes it possible therefore to use the computer to highlight a
particular linguistic pattern and to then have the computer help to determine
the lines or context of data that is significant.
OPTIONS
-l outputs single line context of the linguistic pattern search,
including filename, line number of pattern, line containing pattern
example:
signif -l tool unixtool.0*
-c outputs 10 line context of pattern from files
example:
signif -c tool unixtool.0*
-w outputs entire files that contain the pattern
example:
signif -w tool unixtool.0*
signif - outputs a list of one line references to
pattern, followed by a 10 line context of the pattern from the
files containing the pattern.
signif pattern filename[s]
example:
signif tool unixtool.0*
This is the default
-f allows input of multiple patterns from a file for a
pattern search for each of the linguistic patterns.
example:
signif -f keywordfile unixtool.0*
-k allows input of multiple linguistic patterns from keyboard for
a multiple context search and output.
example:
signif -k keyword1 keyword2 keyword3
USAGE
signif script
signif scripts consist of editing commands that search a series
of files and produce a list of the pattern or expression in the following
form:
[word or expression] [filename or filenames]
SEE ALSO
"Researcher's Toolkit" by Ronda Hauben
grep(), sed(), awk()
BUGS
Duplication of context lines if consecutive references have line
numbers less than 10 lines apart.
Need to name file name that files will be applied to or put
the files in a separate direction and search using wildcard *.
APPENDIX
Following are the shell scripts for each of the options
Replace filename w/ * or Name of files to be searched.
signif
#This is the default
# signif
#!/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 a sample of the form that can be executed
#bugs - If an expression is entered (2 words) it searches the first
#the two words of the expression have to be contained within quotes
#as part of the program for this script to take an expression as input.
# context.sh
# context.sh
#!/bin/sh
#outputs whole files which include the keyword
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}
signif -l
# signif -l
#!/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
echo ok
else
echo Sorry
fi
example: $ signif -l tool unixtool.0*
signif -c
#signif -c
#!/bin/sh
#outputs 10 line context which include the keyword from files
# make sure that there are at least 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
# signif -w
#!/bin/sh
#outputs whole files which include the keyword
awkfile=/tmp/nu.awk2.$$
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 =============================="}
Last Updated:
Tue Apr 26 16:00:14 EDT 1994