Shell script to copy file

Dear all,
I have a database with thousands of files with the structure of name is:
Filename_hour_year.abc
Filename_hour_year_1.abc
..............
So what I need is how to write a script that all file with contain the character "_1" will copy to "_2"
For example: file name: abc_111111_2011_1.abc will be copied to abc_111111_2011_2.abc
Thank all!!!

 
for filename in `ls *_1*`;
do
    newname=`echo $filename | sed -e 's/_1/_2/g'`
    mv $filename $newname
done

Thank Amitranjansahu so much,
It works perfectly...!!

I don't think so.

echo 'abc_111111_2011_1.abc' | sed -e 's/_1/_2/g'

gives as output:

abc_211111_2011_2.abc

instead of:

abc_111111_2011_2.abc

Try:

for file in *_1.abc
do
    newname=${file%_*}_2.abc
    mv $file $newname
done

Sorry all about my unclear question that I gave.
My problem is copy all files file name have character "_1." to "_2." don't care about extension.
For example: I have files:
ads_daily_10_2008_1.MYD
ads_daily_10_2008_1.MYI
ads_daily_10_2008_1.frm
I need script that can copy these files to new files like:
ads_daily_10_2008_2.MYD
ads_daily_10_2008_2.MYI
ads_daily_10_2008_2.frm
Thank in advance.!

HaiNguyen

 echo "ads_daily_10_2008_1.MYD
ads_daily_10_2008_1.MYI
ads_daily_10_2008_1.frm" |awk '{print "cp "$0" "gensub("_1","_2",$0)}' |sh

What is wrong with the solution provided in post# 2? It's almost close to your requirement. With some few modifications however..

for filename in `ls *_1.*`;
do
    newname=`echo $filename | sed 's/_1\./_2./'`
    cp $filename $newname
done

Thank Michaelrozar17 so much.
Your script solved my problem, It worked.

HaiNguyen