Tuesday, 6 January 2009

renaming a large set of files at one shot

Say, I have a set of 20 files of the name

.. and so on up to

I want to rename above files from .done to .gz using shell scripts:

one way is to use a straight rename command.If this command doesnot exist in your unix utilities,this is how we can do:

ls * | while read $file ; do echo "renaming $file" ; mv $file `echo $file | sed 's/.done//'` ; done

All the files are renamed to .gz at one shot.

No comments:

Post a Comment

Tweets by @sriramperumalla