Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- documents=$(find . | grep -e "\.tex$")
- sum=0
- sum_space=0
- for doc in $documents
- do
- echo "Reading $doc"
- letters_text=$(/Library/TeX/texbin/texcount -char $doc | grep 'Letters in text' | grep -o -E '[0-9]+')
- letters_headers=$(/Library/TeX/texbin/texcount -char $doc | grep 'Letters in headers' | grep -o -E '[0-9]+')
- words_text=$(/Library/TeX/texbin/texcount $doc | grep 'Words in text' | grep -o -E '[0-9]+')
- words_headers=$(/Library/TeX/texbin/texcount $doc | grep 'Words in headers' | grep -o -E '[0-9]+')
- letters=$(($letters_text+$letters_headers))
- words=$(($words_text+$words_headers))
- sum=$(($sum+$letters))
- sum_space=$(($sum_space+$letters+$words))
- done
- echo "--- Results ---"
- echo "The total sum of characters (excluding space): $sum"
- echo "The total sum of characters (including space): $sum_space"
- pages=$(echo "print $sum_space/2400" | perl)
- echo "Pages: $pages"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement