[root@host133 cailu]# cat urfile 1 a2 b3 a1 d[root@host133 cailu]# awk '{a[$1]=a[$1]?a[$1]OFS$2:$2}END{for(i in a)print i,a[i]}' urfile 1 a d2 b3 aide