Re: trying to script a command line

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: Main PLUG discussion list
Subject: Re: trying to script a command line
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.
>
> Imagine publishing a book that is 400+ pages all separate Microsoft Word
> documents (now being converted to OpenOffice, adding form elements and
> then exporting into single page PDF documents...and I'm trying to script
> the collection into a single PDF book. Nothing about this has been easy.

----
OK - here is a more complete explanation of my problem...

copying the files to a temporary directory isn't any help because I
could build them on the fly simply by doing...

pdftk /path/to/*.pdf cat output I-A.pdf

but I want them to sort in specific order because...
02a-Grievance Commit Spanish.pdf
sorts before
02-Grievance Committee Find.pdf

so I am figuring I can list the files into a text file, manually arrange
them in the order I want and then build the book with the command.

so this is where my shell script is at now...

#!/bin/sh
#
INPUT_FILE="/path/to/I-A-files.txt"
OUTPUT_FILE="/path/to/I-A.pdf"
IFS=$'\n'

neither of these work...I have spaces in the file names
FILE_LIST=`cat I-A-files.txt | sed 's/ /\ /g'`
FILE_LIST=`cat I-A-files.txt`

#echo "$FILE_LIST"
pdftk "$FILE_LIST" cat output I-A.pdf verbose
unset IFS

and I need $FILE_LIST to look something like below because both of these
commands work (either escaped spaces or enclosed in quotes)...

pdftk \
I-RightsResponsibilitiesEthics/A-ClientRights/02-Grievance\ Committee\
Find.pdf \
I-RightsResponsibilitiesEthics/A-ClientRights/02a-Grievance\ Commit\
Spanish.pdf \
cat output test.pdf verbose

pdftk \
'I-RightsResponsibilitiesEthics/A-ClientRights/02-Grievance Committee
Find.pdf' \
'I-RightsResponsibilitiesEthics/A-ClientRights/02a-Grievance Commit
Spanish.pdf' \
cat output test.pdf verbose

Thanks

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss