I have multiple files which are starting with error_* and i want to rename all of those with a particular name. I am using the below script to do that but it is not working.
counter=1
for i in `ls error*`
do
mv $i ABC$counter_$i
$(( counter++ ))
done
Sample files which I want to rename
error_CO_5010wgs837in.10
error_CO_coprofo.7
I want to use counter values while renaming each of the file, if i don't use counter it works fine. But i want to know why the above script doesn't work.here is the output which my script is giving:
ABCerror_CO_5010wgs837in.10
ABCerror_CO_coprofo.7
The output which i am expecting is as below:
ABC1_error_CO_5010wgs837in.10
ABC2_error_CO_coprofo.7