This script does what you need. It assumes that your files are always in the format of
id value, id2 value2, id3 value3
That is, it assumes comma separated fields and a consistent format across both files. It also assumes a recent version of bash
that supports indexed arrays.
It also gives the correct output, that is the output you ask for and not the output you show (2x25 != 75 for example).
#!/usr/bin/env bash
## Read each line of the first file into the
## array lines1.
mapfile -t lines1 < file1
## Do the same for the 2nd file and the array lines2.
mapfile -t lines2 < file2
declare -A fields2
declare -A fields1
## Iterate through each element of $lines2
## and separate ids from values
for ((i=0; i<${#lines2[@]}; i++)); do
while read id val
do
fields2["$id"]="$val"
done < <(printf "%s\n" "${lines2[$i]//, /$'\n'}")
done
## Iterate through each element of $lines1, separate
## ids from values.
for ((i=0; i<${#lines1[@]}; i++)); do
while read id val
do
## Some ids don't exist in both files, set their
## value to 1 to avoid errors.
if [[ -z "${fields2[$id]}" ]]; then
fields2[$id]=1
fi
## Print the id and the result of the multiplication.
printf "%s %d " $id "$(( ${fields2[$id]} * $val ))";
done < <(printf "%s\n" "${lines1[$i]//, /$'\n'}")
echo "";
done