#!/usr/bin/bash # From https://stackoverflow.com/a/14736593 pdftk "$1" dump_data | grep NumberOfPages | awk '{print $2}'