Say you have a bunch of PDFs and you want to know how many pages each of them has. You could of course use some graphical software to display every single PDF and check the page count (xpdf, evince, whatever), but that gets tedious very fast.
So here's (mostly as a reminder for myself) one way to count pages of many PDFs (in the current directory) using pdfinfo from the xpdf-utils package:
$ cat countpdfpages #!/bin/sh for f in *.pdf; do echo -n "$f: " pdfinfo "$f" 2>/dev/null | grep Pages | cut -d ":" -f 2 done
A sample run:
$ ./countpdfpages S71147.pdf: 25 S71226.pdf: 38 S71242-01.pdf: 25 S71258.pdf: 26 S71315.pdf: 35 S72045.pdf: 2
I'm sure there are many other ways to do this, e.g. using pdftk foo.pdf dump_data (in the pdftk package), please leave a comment if you know a simpler way to achieve this. Especially so if you don't need an extra script to do it (i.e. if there's a PDF command line tool which can already count pages in multiple PDFs). Thanks!
For the uninitiated, ODF is
an open XML-based document file format for saving and exchanging editable office documents (including memos, reports, and books), spreadsheets, charts, and presentations. OpenDocument was developed as an application-independent file format by OASIS (Organization for the Advancement of Structured Information Standards), a vendor-neutral standards organization.
ODF is currently employed by OpenOffice 2.0, KOffice, Abiword, and tons of other applications. Lots of other office suites and programs will likely follow. The recently formed ODF Alliance now has more than 150 member organizations.
(via Nico Golde)