Skip to content

Instantly share code, notes, and snippets.

@padenot
Created November 10, 2011 23:35
Show Gist options
  • Save padenot/1356633 to your computer and use it in GitHub Desktop.
Save padenot/1356633 to your computer and use it in GitHub Desktop.
pdfwc
#!/bin/sh
if [ $# -eq 0 ]
then
echo "$(basename $0) [-w|-c|-l|-L]? file.pdf+"
echo "\t-w : count words"
echo "\t-c : count characters"
echo "\t-l : count lines"
echo "\t-L : maximum line length"
exit 1
fi
wcopt=""
for i in -w -c -l -L
do
[ "$1" = "$i" ] && wcopt="$wcopt $i" && shift
done
pdftotext $* - | egrep -E '\w\w\w+' | wc $wcopt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment