Change the format of the strings

I have Input file as below

1 a
1 b
1 c
2 d
2 e
2 f

I want below output as below.

1 a,b,c
2 c,d,e

Pls suggest how can i do it.

if you expect 2 c,d,e following won't work ...

Try :

This doesn't care about order

$ cat <<eof | awk '{A[$1] = A[$1] ? A[$1] OFS $2 : $2 }END{for(i in A)print i FS A}' OFS=\,
1 a
1 b
1 c
2 d
2 e
2 f
eof

1 a,b,c
2 d,e,f

whereas this cares about order with a assumption that file is sorted

$ cat <<eof | awk '{printf p == $1 ? NR == 1 ? $1 FS $2 : OFS $2 : RS $1 FS $2 }{p = $1}END{printf RS}' OFS=\,
1 a
1 b
1 c
2 d
2 e
2 f
eof

1 a,b,c
2 d,e,f