rename in batch

example test1 will have m1234567.12a
I would like to rename in batch but I don't Please help me on this.

cd /a1/a2/a3
test1=$(basename /a1/a2/a3/*.*) >> /tmp/t
echo $test1
echo "Extracting 8 th position" >> /tmp/t2
awk '{print substr($1,8,1); }' $test1 >> /tmp/t3
echo "extraction done" >> /tmp/t3
echo `date` "extract done timed " >> /tmp/t4

Thanks
kathy

Plz. specify what do you exactly? I did not get you from your input.

# echo m1234567.12a | awk '{print substr($1,8,1); }' gives,
7

i.e if your test1 variable contains m1234567.12a string.

give more inputs so that your question will be solved.

hth.

Using all those temporary files is a terrible way to script and should be avoided if at all possible.

As muthukumar indicates your example does not tell us what you are trying to do. Please provide a clear example of what you are trying to achieve.

i.e., are you trying to rename an entire directory of files according to some specific pattern?

This is what I would consider "renaming in batch"....

cd /path/to/files
ls | while read file; do
  mv ${file} `echo ${file} | sed 's/change_this/to_this/'`
done

There are more ways to tackle this problem but we need a lot more information to be able to assist further.

Thanks,
ZB

ls *.* | (made to cmd) | sh
or
find ./ *.* | xargs -i mv {} {}.bak