Hi Needed help for Unix Newbie

Hi,
Can i get some help from any of you guyz on writing Unix script.
my requirement is like reading a csv file, finding a specific pattern in the lines and repalce the string with new string and write it to another file.

My file is file ABC123.dat
Col1,Col2,Col3
102628,AB10 0,21
102628,AB10 1,21
102628,AB10 2,21
102628,AB23 5,21
102628,AB35 9,21
102628,AB53 8AA,21
102628,AB53 8AB,21
102628,AB53 8AD,21
102628,AB53 8AE,21
102628,AB53 8AG,21
102636,AB54 0,21
102636,AB54 1,21
102636,AB54 2,21
102636,AB54 3,21
102636,AB54 4,21
102636,AB54 5,21
102636,AB54 6,21
102636,AB54 7A,21
102636,AB54 7B,21
102636,AB54 7D,21
102636,AB54 7E,21
888888,A99 9,21

and i have written a small script which finds the the pattern and prints the line numbers too but i am unable to write to another file....

file=/export/home/prashant/ABC123.dat

String1="[,][A-Z][A-Z][0-9][0-9][ ][0-9][,]"
String2="[,][A-Z][0-9][0-9][ ][0-9][,]"
String3="[,][0][,]" # Replacement for the string 1 & 2 if found the pattern in the file.

if [ -f "file" ]; then
echo "File $file does not exist."
exit 1
fi
cmd=$`(grep -c "[$String1|$String2]" $file)`
line=$(grep -n "$String1" $file)
line1=$(grep -n "$String2" $file)

if [ "$cmd" != "0" ]; then

    echo "the String exists what you are expecting in the Line Number"
    echo "$line"
    echo "$line1"

else
echo "Word does not exist."
fi

out put is something like this ....
the String exists what you are expecting in the Line Number
2:102628,AB10 0,85
3:102628,AB10 1,85
4:102628,AB10 2,85
5:102628,AB23 5,85
6:102628,AB35 9,85
12:102636,AB54 0,85
13:102636,AB54 1,85
14:102636,AB54 2,85
15:102636,AB54 3,85
16:102636,AB54 4,85
17:102636,AB54 5,85
18:102636,AB54 6,85
23:888888,A99 9,85

but i am unable to replace the string1 & string2 after finding in the file with the string3 variable to another file .....
thanks
prashant

moved to "scripting" cause it's not high level programing... please watchout to post in the right subforum. thanks!

Advanced Bash-Scripting Guide, Chapter 19: I/O Redirection