Bash question

jim cinetron-uEvt2TsIf2EsA/PxXw9srA at public.gmane.org
Wed Dec 21 02:51:03 UTC 2011


> 
> > 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





More information about the Legacy mailing list