用 Shell 在 PDF 檔案中,找出指定字串
發表於 : 2014-08-20, 06:22
From: http://stackoverflow.com/questions/1444 ... with-shell
Find string inside pdf with shell
As nicely pointed by Simon, you can simply convert the pdf to plain text using pdftotext, and then, just search for what you’re looking for.
After conversion, you may use grep, bash regex, or any variation you want:
Find string inside pdf with shell
As nicely pointed by Simon, you can simply convert the pdf to plain text using pdftotext, and then, just search for what you’re looking for.
After conversion, you may use grep, bash regex, or any variation you want:
代碼: 選擇全部
while read line; do
if [[ ${line} =~ [0-9]{4}(-[0-9]{2}){2} ]]; then
echo ">>> Found date;";
fi
done <<(pdftotext infile.pdf -)