# Bash script to count the number of verses and words in the new Clementine text
# Requirements: Bash shell; several utilities available in GnuWin or cygwin.
# 
# Usage: bash countup.sh
# 
# Output: ABBREV,V,WPLUSV
# for each book, where ABBREV is the standard abbreviation, V the number of
# verses, and WPLUSV is the sum of V and the number of words in the book.

cd c:/projects/vulsearch/newtext
rm ../countup.txt
for X in *.new
do
  Y=`tr -d "?!:;" < $X | wc -w | tr -d ' '`
  Z=`wc -l < $X | tr -d ' \015'`
  echo $X
  echo "${X/.new/},$Z,$Y" >> ../countup.txt
done
CR='\015'
tr -s $CR < ../countup.txt > ../countup.new
cd ..
mv countup.new countup.txt