>>>>> "elliott-brennan" == elliott-brennan <[EMAIL PROTECTED]> writes:
elliott-brennan> Hi all,
elliott-brennan> Now, I know I've asked a similar questions, but I
elliott-brennan> thought that I'd ask again with what may be a clearer
elliott-brennan> request :))))) For example:
elliott-brennan> I have a collection of images labelled -
elliott-brennan> a_0001.jpeg through to A0999.jpeg b_0001.jpeg through
elliott-brennan> to A0999.jpeg c_0001.jpeg through to A0999.jpeg
elliott-brennan> d_0001.jpeg through to A0999.jpeg
elliott-brennan> I want to merge them as follows:
elliott-brennan> montage -geometry +4+4 a_0001.jpeg b_0001.jpeg
elliott-brennan> c_0001.jpeg d_0001.jpeg montage00001.jpeg
elliott-brennan> the output file is montage<number>.jpeg and needs to
elliott-brennan> be a sequentially increasing number.
You need to do it one number at a time.
for i in `seq -f '%04.f' 1 999`
do
montage -geometry +4+4 {a,b,c,d}_$i.jpeg montage$i.jpeg
done
I'm not sure about the best way to do the _ to A series though.
A simplish way would be:
for file in a*
do
num=`expr "$file" : "a\(.*\)\.jpeg"`
montage -geometry +4+4 {a,b,c,d}$num.jpeg montage$num.jpeg
done
but this preserves the _->A sequence, so you'll end up with
montage_0001.jpeg through to montageA999.jpeg.
If you want to replace the _->A with 0->whatever you need a tr line in
there:
for file in a*
do
num=`expr "$file" : "a\(.*\)\.jpeg"`
outnum=`echo $num | tr '_A' '01'`
montage -geometry +4+4 {a,b,c,d}$num.jpeg montage$outnum.jpeg
done
Use your collating sequence, as I don't know what it is ('_' comes
after 'A' in ASCII).
--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au ERTOS within National ICT Australia
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html