Bash question

Stewart C. Russell scruss-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Dec 21 03:12:47 UTC 2011


You could do something like:

ls *pdf | sed 's/_.*//;' | sort -u | while read prefix
do
  pdftk --outfile joined_${prefix}.pdf --infiles ${prefix}*pdf
done

This gives you loop over every unique prefix. I've assumed that every 
file starts with prefix+'_'. I know I have the arguments for pdftk 
wrong; it's slightly odd the way it's used. But I hope you get the idea.

cheers,
  Stewart
--
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