
hi after some downloads I ended up with 175 files with names that looked like scan=scan. after some attempts which I renamed with this vastly sub-optimal script $ for i in `ls *=*`; do out=`echo $i | sed -e 's@[^*=]*@@'`; of=`echo $out | sed 's/=//'`; mv $i $of; done so looking for a hint on how better to have done it. Steve

On 27/09/11 6:21 PM, Steve Roylance wrote:
hi
after some downloads I ended up with 175 files with names that looked like scan=scan.
after some attempts which I renamed with this vastly sub-optimal script $ for i in `ls *=*`; do out=`echo $i | sed -e 's@[^*=]*@@'`; of=`echo $out | sed 's/=//'`; mv $i $of; done
so looking for a hint on how better to have done it.
You should have a look at the rename command, "man rename" ought to show you what you need to do. If the files were all something like scan=scanXXX.jpg and you want to replace the "scan=scan" at the beginning of each filename with "foo-" then the command would be along the lines of: rename scan=scan foo- scan* One of the more popular examples, which is in the man page, is: rename .htm .html *.htm Regards, Ben
participants (2)
-
Ben McGinnes
-
Steve Roylance