AWK solution (ordered by sort command):
awk 'NR==FNR{ a[$1]; next }$1 in a' file1 FS='[[:space:]]*,[[:space:]]' file2 | sort FS='[[:space:]]*,[[:space:]]'- field separator specifiedthat is set forfile2
The output:
aa , 6 , tg16 bb , 7 , tg17 cc , 8 , tg18 dd , 3 , tg13