Skip to content

Instantly share code, notes, and snippets.

@Telling
Created February 2, 2015 22:14
Show Gist options
  • Save Telling/7b5ebaba6497e4d8c821 to your computer and use it in GitHub Desktop.
Save Telling/7b5ebaba6497e4d8c821 to your computer and use it in GitHub Desktop.
count stuff with pdftotext
# Count how many pages approximately in PDF (1 page = 2400 chars)
pagecount() {
echo $(( $(pdftotext "$*" - | tr -d '.' | wc -m) / 2400.00 ))
}
# Count characters in PDF
charcount() { pdftotext "$*" - | tr -d '.' | wc -m }
# Count words in PDF
wordcount() { pdftotext "$*" - | tr -d '.' | wc -w }
# Count lines in PDF
linecount() { pdftotext "$*" - | tr -d '.' | wc -l }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment