awk '{h[$1] = h[$1] " " $2} END { for (key in h) print key h[key] }' < input | sort