私が行ったgrep検索に基づいていくつかのコマンドを適用しgrep -l "If you wish to distribute" *.pdf
たいのですが、処理したいファイルが表示されますが、次のbashスクリプトではファイルが処理されません:
#!/bin/bash -x
text1="If you wish to distribute" #Science papers
# Originally: grep -l "text1" \*.pdf |
grep -l "$text1" *.pdf |
while IFS="" read -r -d "" file; do
noext="${file%\.*}"
pdftk "$file" cat 2-end output "$noext".tmp
mv -f "$noext".tmp "$file"
done
そして出力は
+ IFS=
+ grep -l 'If you wish to distribute' project_latex.pdf 'Science 2003 Metapopulation Persistence with Age-Dependent Disturbance or Succession.pdf' 'Science 2006 A Keystone Mutualism Drives Pattern in a Power Function.pdf' short-math-guide.pdf Test.pdf
+ read -r -d '' file