I am trying to write a bash script to merge all pdf files of a directory into one single pdf file. The command pdfunite *.pdf output.pdf
successfully achieves this
Do it in multiple steps. I am assuming you have files from 1 to 99.
pdfunite $(find ./ -regex ".*[^0-9][0-9][^0-9].*" | sort) out1.pdf
pdfunite out1.pdf $(find ./ -regex ".*[^0-9]1[0-9][^0-9].*" | sort) out2.pdf
pdfunite out2.pdf $(find ./ -regex ".*[^0-9]2[0-9][^0-9].*" | sort) out3.pdf
and so on.
the final file will consist of all your pdfs in numerical order.
!!! Beware of writing the output file such as out1.pdf etc. otherwise pdfunite will overwrite the last file !!!
Edit: Sorry I was missing the [^0-9] in each regex. Corrected it in the above commands.