Bash question

Howard Gibson hgibson-MwcKTmeKVNQ at public.gmane.org
Wed Dec 21 02:29:39 UTC 2011


On Tue, 20 Dec 2011 20:08:01 -0500
jim <cinetron-uEvt2TsIf2EsA/PxXw9srA at public.gmane.org> wrote:

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

-- 
Howard Gibson 
hgibson-MwcKTmeKVNQ at public.gmane.org
howard.gibson-PadmjKOQAFnQT0dZR+AlfA at public.gmane.org 
jhowardgibson-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
http://home.eol.ca/~hgibson
--
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