./renumberer 1081 360 -720 CD267A_3_pk_1_%04d.img
Now you can do this any time you want without editing a script. See common unix formatting for the part after the "%" in the template. You can follow the example above and modify the program to accept a template both for the old file and the new file to increase the generality.
The downside is that you can't use it to show off the fact that you can do awk.
James
On Dec 9, 2010, at 5:51 PM, wu donghui wrote:
Dear all,
I need a script to renumber my image. My initial image number ranges from *_1081.img to *_1440.img. There are 360 images in total. I want to renumber these images with the ranges from *_361.img to *_720.img, that means every initial image-720, but I don't know how to do it. Below is my script draft.
#! /bin/csh -f
@ i = 1081
while ( $i >= 1081 )
while ($i <= 1440 )
echo mv CD267A_3_pk_1_$i.img CD267A_3_pk_1_$i-720.img
@ i++
end
exit
Can anyone help me for this script? Thank you very much.
Best regards,
Donghui