Hi Yanming:
Using zsh shell, this is very easy.
I have the following pre-defined in ~/.zshrc
autoload -U zmv
alias mmv='noglob zmv -W'
so all I have to do is type
mmv foo_10[0-9][0-9].img foo_1[0-9][0-9].img
mmv foo_11[0-9][0-9].img foo_2[0-9][0-9].img
mmv foo_12[0-9][0-9].img foo_3[0-9][0-9].img
zsh has a lot of nice features, like customized command completions
and even remote filename completions with scp.
zsh combines the user-friendliness of tcsh with the programmability
and non-goofiness of bash.
HTH,
Bill
William G. Scott
Contact info:
http://chemistry.ucsc.edu/~wgscott/
On Aug 7, 2008, at 1:40 AM, yanming Zhang wrote:
> 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
>
>
>
|