ディレクトリ内のすべてのpdfファイル内を検索するスクリプトを作成しています。「pdftotext」という名前の変換されたものを見つけました。これにより、pef ファイルで grep を使用できるようになりますが、1 つのファイルでしか実行できません。ディレクトリに存在するすべてのファイルに対して実行したい場合、失敗します。助言がありますか ?
これは機能します:単一のファイルの場合
pdftotext my_file.pdf - | grep 'hot'
これは失敗します:pdfファイルを検索し、テキストに変換してgrepingする場合
SHELL PROMPT>find ~/.personal/tips -type f -iname "*" | grep -i "*.pdf" | xargs pdftotext |grep admin
pdftotext version 3.00
Copyright 1996-2004 Glyph & Cog, LLC
Usage: pdftotext [options] <PDF-file> [<text-file>]
-f <int> : first page to convert
-l <int> : last page to convert
-layout : maintain original physical layout
-raw : keep strings in content stream order
-htmlmeta : generate a simple HTML file, including the meta information
-enc <string> : output text encoding name
-eol <string> : output end-of-line convention (unix, dos, or mac)
-nopgbrk : don't insert page breaks between pages
-opw <string> : owner password (for encrypted files)
-upw <string> : user password (for encrypted files)
-q : don't print any messages or errors
-cfg <string> : configuration file to use in place of .xpdfrc
-v : print copyright and version info
-h : print usage information
-help : print usage information
--help : print usage information
-? : print usage information
SHELL PROMPT 139>