On Tue, 20 Mar 2012 14:52:34 +0000 John K Pate <j.k.pate@sms.ed.ac.uk> wrote:
Thanks to John K Pate but i dont at the moment have time to sit and digest heaps of variables i just need to solve this one problem .
You want to be able to change "img_0004.jpg" to "img_0004_s.jpg", right? You can use the built-in string replace functionality of bash to achieve this (described in the first hit of that google search):
$ f=img_0004.jpg $ echo $f img_0004.jpg $ echo ${f/.jpg/_s.jpg} img_0004_s.jpg
== John K Pate http://homepages.inf.ed.ac.uk/s0930006/
Hi John .. well sort of yes what it is the structure of the gallery is the main pictures in a dir then in a sub dir are the thumbnails which are named such as img0005-s.jpg for the thumbnails and img0005.jpg for the main pictures , it would make life a lot easier if the script was able to setup the main and the thumbs correctly what happens right now is it sets both to the main image name meaning i have to go in and edit up to 500 lines PITA there is enough variance to make the automatic find and replace fail .. Pete . -- Linux 7-of-9 3.2.11-1-ARCH #1 SMP PREEMPT Thu Mar 15 09:19:02 CET 2012 x86_64 AMD Phenom(tm) 9600B Quad-Core Processor AuthenticAMD GNU/Linux