Re: trying to script a command line

2008-03-05 Thread Craig White
On Wed, 2008-03-05 at 14:37 -0700, Mike Bydalek wrote: > Craig White wrote: > > OK - truly simplifying my issue to a point where someone should be able > > to explain this to me... > > > > # my starting file > > $ cat test-db.txt > > A 1 > > B 2 > > C 3 > > > > # this is what I want > > $ cat test

Re: trying to script a command line

2008-03-05 Thread Craig White
On Wed, 2008-03-05 at 14:14 -0700, Charles Jones wrote: > Craig White wrote: > > OK - truly simplifying my issue to a point where someone should be able > > to explain this to me... > > > > # my starting file > > $ cat test-db.txt > > A 1 > > B 2 > > C 3 > > > > # this is what I want > > $ cat tes

Re: trying to script a command line

2008-03-05 Thread Mike Bydalek
Craig White wrote: > OK - truly simplifying my issue to a point where someone should be able > to explain this to me... > > # my starting file > $ cat test-db.txt > A 1 > B 2 > C 3 > > # this is what I want > $ cat test-db.txt | cat test-db.txt | sed 's/ /\\ /g' | sed ':a;N;$! > ba;s/\n/ /g' > A\ 1

Re: trying to script a command line

2008-03-05 Thread Charles Jones
Craig White wrote: > OK - truly simplifying my issue to a point where someone should be able > to explain this to me... > > # my starting file > $ cat test-db.txt > A 1 > B 2 > C 3 > > # this is what I want > $ cat test-db.txt | cat test-db.txt | sed 's/ /\\ /g' | sed ':a;N;$! > ba;s/\n/ /g' > A\ 1

Re: trying to script a command line

2008-03-05 Thread Craig White
OK - truly simplifying my issue to a point where someone should be able to explain this to me... # my starting file $ cat test-db.txt A 1 B 2 C 3 # this is what I want $ cat test-db.txt | cat test-db.txt | sed 's/ /\\ /g' | sed ':a;N;$! ba;s/\n/ /g' A\ 1 B\ 2 C\ 3 # but if I aggregate the comman

Re: trying to script a command line

2008-03-05 Thread Craig White
On Tue, 2008-03-04 at 22:31 -0700, Craig White wrote: > $ mkdir temp; IFS=$'\n'; for file in `cat I-A-files.txt | sed > 's/ /\ /g'`; do cp -v "$file" temp; done; cd temp; pdftk *.pdf cat > output ../I-a.pdf verbose ; unset IFS > > This last one sort of worked...It's fixable/workable anyway. > >

Re: trying to script a command line

2008-03-04 Thread Craig White
pdftk isn't all that friendly towards scripting...I'll say that much. I am going to work on this tomorrow...but to give you some feedback - and I appreciate all of the thinking that you did on this.. $ cat I-A-files.txt | sed 's/ /\\ /g' | xargs cat | pdftk - output I-A.pdf verbose result, only

Re: trying to script a command line

2008-03-04 Thread Charles Jones
Ahh yeah...can't believe I didn't think of that. BTW, for pdftk, "cat" is a command line option, not referring to the cat we know and love. I think the final ver of the command would be: cat I-A-files.txt |xargs -i pdftk "{}" cat output I-A.pdf verbose Okay...my head hurts now :) -Charles E

Re: trying to script a command line

2008-03-04 Thread Charles Jones
Before you say that last attempt didn't work, I just saw another example usage that gave me an idea: "or (Using Wildcards): pdftk *.pdf cat output combined.pdf" So, now this should do it: mkdir temp; IFS=$'\n'; for file in `cat I-a-files.txt | sed 's/ /\ /g'`; do cp -v "$file" temp; done; cd t

Re: trying to script a command line

2008-03-04 Thread Erich Newell
xargs has additional flexibility...try using the "replace string" parameter So do: cat list.txt | xargs -i cat "{}" | pdftk output - The curly braces indicate where the input goes...in this case, between the quotes. Should handle those pesky spaces for you. Looks like this will dump a ton of pd

Re: trying to script a command line

2008-03-04 Thread Charles Jones
Hmm pdftk doesn't seem too friendly in regards to the order of the arguments, it would be much easier if you could specify the input files last on the command linehow does it tell the difference between the filenames and the rest of the args (what if you have a file called "output")?? Her

Re: trying to script a command line

2008-03-04 Thread Craig White
Again, that works but it fails because the PDF includes on the last file. As I said, I don't think an xargs thing is going to work at all because as the man page states...the '-' option is to pass only a single file via stdin. Craig On Tue, 2008-03-04 at 19:10 -0700, Charles Jones wrote: > Ah t

Re: trying to script a command line

2008-03-04 Thread Charles Jones
Ah those darn spaces sure cause problems :) Give this a try: $ cat I-A-files.txt | sed 's/ /\\ /g' | xargs cat | pdftk - output I-a.pdf verbose It works for my test case: $ cat file.txt file with spaces some other file $ cat "file with spaces" This is the contents of a file with spaces $ cat s

Re: trying to script a command line

2008-03-04 Thread Craig White
That doesn't seem to work. I quoted the part of the man page that the '-' is used to pass only a single PDF into pdftk via stdin and thus the xargs thing seems not to fly. $ cat I-A-files.txt | xargs -0 pdftk cat output I-A.pdf verbose Error: No input files. Exiting. Errors encountered. No outpu

Re: trying to script a command line

2008-03-04 Thread Charles Jones
I just noticed that you said some of the filenames have spaces, so use the -0 option, which should take care of that (man xargs for more info). -Charles Charles Jones wrote: > Give this a try: > > cat /path/to/filenames_file.xt |xargs pdftk > -

Re: trying to script a command line

2008-03-04 Thread Charles Jones
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... > > A list of the input PDF files. If you plan to

trying to script a command line

2008-03-04 Thread Craig White
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... 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. Us