Removing the first page from a series of PDF files

I have a series of PDF files ( Computer games problems ), and I want to remove the first page from the pdf file of each problem. There are 100 questions, so the graphical interface is just not going to cut it. I used pdftk to remove the first page from one problem:

pdftk 1981_1112_issue1.pdf cat 1 output 1.pdf

My problem is that I do not want to modify and run this command for every problem with the PDF, since it is not much better than the GUI method.

Using * .pdf as an input does not work. What other methods can I use to run pdftk in every PDF file?

+3
source share
2 answers

. , "issue" "output". 1, :

for issue in *_issue*.pdf
do
    pdftk ${issue} cat 1 output page1_${issue/issue/output}
    pdftk ${issue} cat 2-end output otherpages_${issue/issue/output}
done
+5
shopt -s nullglob
for file in *.pdf
do
 out=${file%.pdf}_page1.pdf
 pdftk "$file" cat 1 output "$out"
done
0

Source: https://habr.com/ru/post/1769856/


All Articles