0
I want to use pdfunite to merge several pdf-files into one output file. Since the directory contains lots of different stuff, I thought i could use ls/grep to get the apropriate file-names and then use pdfunite to get it put together. The output of ls/grep look like this:
ls | grep "handout...pdf"
handout01.pdf*
handout02.pdf*
handout03.pdf*
handout04.pdf*
handout05.pdf*
handout06.pdf*
Then I want to invoke pdfunit, which has the following syntax:
pdfunite [options] PDF-sourcefile1..PDF-sourcefilen PDF-destfile
My Problem is, that it does not seem like I can pipe the output of ls/grep into pdfunite, because it is not supposed to work like that. On the otherhand, if I try:
pdfunite ls | grep "handout...pdf" grep.pdf
then grep obviously complains about my chosen output-file:
grep: grep.pdf: No such file or directory
I know I could do two seperate steps and then it would work, but I'd like to figure out how to do this with one line.
True. But using
ls
for this is really evil (though common). You have no guarantee that the output of ls will be consistent. It often is aliased. Find otoh is consistent. – Hennes – 2015-05-20T18:41:17.577True that. I wanted to provide an answer using his original attempts, however, so I didn't use
find
– Russell Uhl – 2015-05-20T18:42:56.3471Oh, it is a good answer for the OP. I just wanted to state that for all the other people who will eventually read this. – Hennes – 2015-05-20T19:01:12.297