Q:

bash merge 2 files with common atributes

I have two files and I would like to merge them. The files are like below:
File 1:
8870:0/28,13
8870:2/22,1
8870:2/25,3
887:3/29,1
886:1/40,4
886:1/41,2
886:1/43,4

File 2:
8870:0,16
8870:2,9
887:3,5
886:1,31

Output:
8870:0,16,13
8870:2,9,4
887:3,5,1
886:1,31,10

In other words, in the output I want the F2 adding a column with the sum w of same x:y (x:y/z,w).

A:

"I wonder how can I manage this task." Do not wonder, be curious and read as you can about sed and awk. Take what it follow as an hint.

First convert the format of file1 to the format of file2 discarding what is not needed.
sed 's/\/.*\,/\,/' file1.txt   # here you erase what in between `/` and `,`

then process it with awk and associative arrays
sed 's/\/.*\,/\,/' file1.txt  \
| awk -F ',' '{A[$1]=A[$1]+$2}END{for (b in A) print b","A[b]}' > file1b.txt

| pipe redirection
\ it allows to continue in the next line (no other characters after)
> file1b.txt, if you want you can redirect all to a new file.
Now you can use again associative array of awk with the 2 files file2.txt and file1b.txt (you want to add to the file2.txt so you have to write it for first)
awk -F ',' '{if (A[$1]=="" ) {A[$1]=A[$1]$2} \
else {A[$1]=A[$1]","$2}}END{for (b in A) print b","A[b]}' \
   file2.txt file1b.txt | sort -nr

The final | sort -nr sort the output in reverse order (-r) with numeric order (-n).

Note that you do not need to create the file1b.txt 
#!/bin/bash

( \
  cat file2.txt ; \
  sed 's/\/.*\,/\,/' file1.txt  |  \
  awk -F ',' '{A[$1]=A[$1]+$2}END{for (b in A) print b","A[b]}' ;
) | \
awk -F ',' '{if (A[$1]=="" ) {A[$1]=A[$1]$2} else {A[$1]=A[$1]","$2}} \
END{for (b in A) print b","A[b]}'| sort -nr

