Z=zaplist.xrc
H='
==========
zaplist file(s)
==========
make a list of words and their frequency of occurence in the
named files. if the file zaplist.xrc does NOT exist in the
current directory, output is written to this file, otherwise to
stdout.
==========
BUGS
==========
*	multi-element pipe may break or be slow on some systems.
*	specific to KWIK hashed search exclusion function
==========
'
:
case $1 in
	-h)	clear;echo "$H";exit 0;;
esac
:
COMMENT='
(a)	break file(s) into words mapped to lower case alpha
(b)	sort
(c)	uniq -c to get a count
(d)	sort by count
'
trap 'rm -f zl$$.???;exit' 0 1 2 3 4 14
BARF=`echo -n`
case $BARF in
	-n)	BARF='\c';;
	*)	BARF="-n";;
esac
if test -r $Z
then
echo 1>&2 "output to stdout"
else
echo 1>&2 "output to $Z"
fi
echo $@ > kbreak.xrc
echo 1>&2 "$BARF" "dissolving    "
kbreak -v0 -m -l0 -r0 > zl$$.001
echo 1>&2
echo 1>&2 "$BARF" "sorting       "
sort -o zl$$.001 zl$$.001
echo 1>&2
echo 1>&2 "$BARF" "counting      "
uniq -c zl$$.001 > zl$$.002
echo 1>&2
echo 1>&2 "$BARF" "sorting count "
sort +0 -1nr +1 -2d zl$$.002 > zl$$.tmp
echo 1>&2
#
if test -r $Z
then
cat zl$$.tmp
else
mv zl$$.tmp $Z
fi
