using awk multiplication

Suppose i have a file A
1*2*34
2*4*4
22

and second file B
2*3*45
4*4*6
7

By multiplying file A by file B that is file A by first column in file B respectively
output shud be

2*6*1220
8*16*24
154

my code is

[CODE][/
for a in A
do
for FILE in B
do
awk 'NR==FNR {
x[FNR] =$1
next
}
{for (f=1;f<=NF;f++)
$f*= x[FNR]
} 1' OFS='' FS='' $a $FILE >file_output
done
done
CODE]

then output was
2*3*45
8*8*12
14

Use nawk or /usr/xpg4/bin/awk on Solaris.

awk -F"*" '
NR==FNR{for(i=1;i<=NF;i++){a[NR,i]=$i}next}
{for(i=1;i<=NF;i++){printf("%s%s",a[FNR,i]*$i,i==NF?"\n":"*")}}
' fileA fileB

Regards

Another approach:

awk -F\* 'getline _ < "fileB" {
  split(_, t); for (i=1;i<=NF;i++) 
    printf $i * t (i==NF?RS:FS)
    }' fileA