Bash question

Alex Gabriel alexgabriel-Nmj6Sl6vboSovDFt+AQlJdBPR1lH4CV8 at public.gmane.org
Wed Dec 21 03:19:35 UTC 2011


Are you looking to merge all files into a single PDF based on the file name, or will you create multiple PDF documents from a series of files?

I.e. 6230718*.pdf is merged into 6230718.pdf and 6230719*.pdf is merged into 6230719.pdf or all files into arbitrary-name.pdf

What tools are installed with regard to PDF generation?  I typically use GhostScript to join PDF files, but it may not be the best option when dealing with an arbitrary number of files. 
------Original Message------
From: jim
Sender: owner-tlug at ss.org
To: tlug at ss.org
ReplyTo: tlug at ss.org
Subject: Re: [TLUG]: Bash question
Sent: Dec 20, 2011 21:51


> 
> > Hi,
> > I have a bash or scripting question. I have a few hundred files in a
> > directory, They have file names formatted similar to below:
> > 6230718_1puJ0P8Z_file1.pdf
> > 6230718_b9nP4YtD_file2.pdf
> > 6230718_O1F0Qj0p_file3.pdf
> > 6233064_c9yOocTq_file4.pdf
> > 6233064_ON8OdanT_file5.pdf
> > 6233064_X64AbjZZ_file6.pdf
> > 
> > I want to take all the files that have the same 7 digit numbers at the
> > front end of the file names and join the PDF files. There are not always
> > 3 files associated with the same 7 digit number. Sometimes there are
> > more or less than 3 pdf files to join. I figured I can use pdftk to join
> > the files but trying to figure out how to easily select and sort a
> > random number of PDFs has me a bit stumped. Any takers?
> > Thanks,
> > Jim
> Jim,
> 
>     For any sort of weird, complicated text processing, I strongly recommend Perl.  
> 
>     You can capture the directory list by going ls 6233064*.  You can feed this to the next command.

Thanks. I would prefer not to have to do an ls  for each 7 digit number.
There are at least 100 of these unique 7 digit numbers in the directory.
I was thinking I may have to use the linux " uniq " command in here to
somehow first get all the unique numbers??

Jim
> 


--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists

Sent from my BlackBerry device on the Rogers Wireless Network


More information about the Legacy mailing list