#!/bin/csh -f

cd $1

echo "Removing old word files...."
rm -f allwords ??letwords upto10letwords upto19letwords bigletwords\
	*.hash *.text
echo "Creating new allwords file...."
cat addedwords ispellwords websterwords | sort | uniq > allwords

echo "Creating empty template word files...."
touch 0{4,5,6,7,8,9}letwords 1{0,1,2,3,4,5,6,7,8,9}letwords \
	2{0,1,2,3,4,5}letwords

echo "Creating < 10, < 19 and < 25 letter word files...."
awk '{ if (length < 4) next \
       else if (length < 10) print > "upto10letwords" \
       else if (length < 19) print > "upto19letwords" \
       else if (length < 26) print > "bigletwords" }' allwords
echo "Splitting them up...."
awk '{ print > 0 length "letwords" }' upto10letwords
awk '{ print > length "letwords" }' upto19letwords
awk '{ print > length "letwords" }' bigletwords

echo "Getting rid of work files...."
rm -f upto10letwords upto19letwords bigletwords

exit 0


