Tente isto:
$ awk '
FNR == NR {
a[$1] = $2;next
}
{
split(a[$1],b,",");
for (i in b) {
if ($2 == b[i]) {
printf("%s %s\t*\n",$1,a[$1]);
next;
}
}
print $1,a[$1];
}
' file1 file2
A 1,2,3,4 *
B 15,16,17
Atualizar
Com sua nova entrada, tente:
$ awk '
FNR == NR {
a[$1] = $2;
next;
}
{
split($2,b,",");
split(a[$1],c,",");
for (i in b) {
if (b[i] in c) {
printf("%s %s\t*\n",$1,a[$1]);next;
}}
print $1, a[$1];
}
' file1 file2