Hi there, this should work: !/bin/tcsh #renames 080123_131f07####.osc to 0801123_131f07_####.osc #run by typing ./rename.com for fil in `ls 080123_131f07[0-9][0-9][0-9][0-9]*` do echo $fil new=`echo $fil | sed -e 's/080123_131f07/080123_131f07_/g'` mv $fil $new done
Cheers Ole ________________________________________________ Ole Andreas Andersen Structural Biology Evotec (U.K.) Ltd 114 Milton Park Abingdon Oxon OX14 4SA United Kingdom Tel: 0044 (0)1235 838891 email: [EMAIL PROTECTED] ________________________________ From: CCP4 bulletin board [mailto:[EMAIL PROTECTED] On Behalf Of yanming Zhang Sent: 07 August 2008 09:41 To: [email protected] Subject: [ccp4bb] Change reflection file names All UNIX gurus, I need to change 300 image file names sequentially, such as: XXX_10001.img to XXX_101.img XXX_10002.img to XXX_102.img ................ Obviously, using UNIX 'mv' to work on 300 files is stupid. Anyone can give me a very simple UNIX shell file to finish the job quickly? Thank you! Yanming Evotec (UK) Ltd is a limited company registered in England and Wales. Registration number:2674265. Registered office: 114 Milton Park, Abingdon, Oxfordshire, OX14 4SA, United Kingdom.
