BlogBlog ÜbersichtjailscriptportsoptFreeBSDLinksThermoskanne

PDF-Dateien durchsuchen

Mit Hilfe von pdfgrep kann eine PDF-Datei wie mit grep(1) durchsucht werden. Im FreeBSD-Portbaum findet man pdfgrep unter textproc/pdfgrep:

# cd /usr/ports/textproc/pdfgrep && make install clean

Nun kann die PDF-Datei nach Wörtern oder regulären Ausdrücken durchsucht werden und alle Zeilen welche den Suchbegriff beinhalten werden ausgegeben:

# pdfgrep "zpool upgrade" zfsadmin.pdf
Upgrading ZFS Storage Pools (zpool upgrade) .............21
Upgrading ZFS Storage Pools (zpool upgrade)
Upgrading ZFS Storage Pools (zpool upgrade)
version to take advantage of the latest features by using the zpool upgrade command. In
you can upgrade your pools with the zpool upgrade command to take advantage of the pool
action: Upgrade the pool using âzpool upgradeâ. Once this is done, the
# zpool upgrade -v
Then, you can run the zpool upgrade command to upgrade your pools. For example:
# zpool upgrade -a
zpool upgrade, 78

Mit der -n Option wird die Seitezahl angezeigt auf welcher Seite im Dokument man die angezeigte Zeile findet:

# pdfgrep -n "zpool upgrade" zfsadmin.pdf 
3: Upgrading ZFS Storage Pools (zpool upgrade) .............21
13: Upgrading ZFS Storage Pools (zpool upgrade)
21: Upgrading ZFS Storage Pools (zpool upgrade)
21: version to take advantage of the latest features by using the zpool upgrade command. In
78: you can upgrade your pools with the zpool upgrade command to take advantage of the pool
78: action: Upgrade the pool using âzpool upgradeâ. Once this is done, the
78: # zpool upgrade -v
79: Then, you can run the zpool upgrade command to upgrade your pools. For example:
79: # zpool upgrade -a
192: zpool upgrade, 78

Mehr Informationen zu pdfgrep findet man in der Manpage pdfgrep(1).

Comments (2)  Permalink