diff --git a/xwords4/dawg/mkindex.sh b/xwords4/dawg/mkindex.sh new file mode 100755 index 000000000..f59979d25 --- /dev/null +++ b/xwords4/dawg/mkindex.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +set -u -e + +usage() { + echo "usage: $0 /path/to/dicts" + echo " write to stdout an html file that serves up all .xwd files inside /path/to/dicts" + exit 1 +} + +do_lang() { + LANG=$1 + echo "$LANG" + + cd $LANG + for DICT in $(ls *.xwd); do + echo "" + echo "${DICT#.xwd}" + SIZE=$(ls -l $DICT | awk '{print $5}') + echo "${SIZE}" + HEXCOUNT=$(hd $DICT | head -n 1 | awk '{print $6 $7 $8 $9}' | tr [a-f] [A-F]) + DECCOUNT=$(echo "ibase=16;$HEXCOUNT" | bc) + echo "${DECCOUNT}" + echo "" + done + + cd .. +} + +[ $# -eq 1 ] || usage + +WD=$(pwd) +cd $1 + +DIRS="" +for DIR in $(ls); do + if [ -d $DIR ] && ls $DIR/*.xwd >/dev/null 2>&1; then + DIRS="$DIRS $DIR" + fi +done + + +echo "" +echo "" +echo "" +for DIR in $DIRS; do + do_lang $DIR +done +echo "
FileSizeWordcount
" +echo "" + + +cd $WD +