Say, I have a set of 20 files of the name
sriram1_1231255960_data.gz.done
sriram2_1231255961_data.gz.done
sriram3_1231255962_data.gz.done
..
.. and so on up to
..
sriram20_1231255980_data.gz.done
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