Klipp och klistra in följande i ett skript som du kallar för pdfmerge.sh, eller liknande:
#!/bin/bash
# pdfmerge - Written by Jeff Spirko <spirko at yahoo.com>, based on
# http://ktmatu.com/info/merge-pdf-files/
# Requires that ghostscript is installed and in the path, and of
# course the bash shell that is provided with all Linux distros.
# Usage: pdfmerge file1.pdf file2.pdf ...
# Creates the file merged.pdf and leaves some .ps files laying
# around.
for f ; do
pdf2ps $f
# acroread -toPostScript -level2 $f # Alternate if you have acrobat.
done
# Header for merged.ps
cat > merged.ps <<EOF
%!PS
% Written by Helge Blischke, see
% http://groups.google.com/groups?ic=1&selm=3964A684.49D%40srz-...
%
% The following 2 procs encapsulate the jobs to be processed
% much as is done with EPS images:
/_begin_job_
{
/tweak_save save def
/tweak_dc countdictstack def
/tweak_oc count 1 sub def
userdict begin
}bind def
/_end_job_
{
count tweak_oc sub{pop}repeat
countdictstack tweak_dc sub{end}repeat
tweak_save restore
}bind def
EOF
# Per-file information in merged.pdf
for f ; do
echo _begin_job_ >> merged.ps
printf "(%s)run\n" ${f/pdf/ps} >> merged.ps
echo _end_job_ >> merged.ps
done
ps2pdf merged.ps
Det kräver att du har Ghostscript installerat.