trying to script a command line

Charles Jones charles.jones at ciscolearning.org
Tue Mar 4 17:24:39 MST 2008


Give this a try:

cat /path/to/filenames_file.xt |xargs pdftk

-Charles

Craig White wrote:
> I have an awkward situation with pdftk
>
> I have a file with filenames that I want to pass to pdftk as input
> files.
>
> according to the man page...
> <input PDF files | - | PROMPT>
>   A list of the input PDF files. If you plan to combine these PDFs
>   (without using handles) then list files in the  order  you  want
>   them combined.  Use - to pass a single PDF into pdftk via stdin.
>
> and thus, this doesn't work...
>
> pdftk `cat "/mypath/to/I-A-files.txt"` cat output I-A.pdf verbose 
>
> fails on spaces within the paths/filenames in that file.
>
> I have tried both escaping the spaces with \ and enclosing each path
> within a double quote but neither works.
>
> I have also tried (which fails)...
>
> $ cat "/mypath/to/I-A-files.txt" | pdftk - cat output I-A.pdf verbose
> Error: Failed to open PDF file:
>    -
> Errors encountered.  No output created.
> Done.  Input errors, so no output created.
> sh-3.2$ ls -l
> total 4440
> -rw-r--r-- 1 craig administrative      10 2008-03-04 15:15 doc_toc.html
> -rw-r--r-- 1 craig administrative    1898 2008-03-04 15:30 I-A-files.txt
>
> Any suggestions on this?
>
> T



More information about the PLUG-discuss mailing list