原始数据:
1 Alyrata 489168
1 Athaliana AT5G23110.1
1 Crubella Carubv10000018m
1 Thalophila Thhalv10003499m
1 Brapa Bra013017
1 Tparvula Tp2g24010
2 Alyrata 355042
2 Athaliana AT4G17140.3
2 Crubella Carubv10006303m
2 Thalophila Thhalv10024176m
2 Brapa Bra021067
2 Tparvula Tp7g17050
3 Alyrata 473945
3 Athaliana AT1G48090.1
3 Crubella Carubv10012395m
3 Thalophila Thhalv10011170m
3 Brapa Bra014101
3 Tparvula Tp1g35040
如果第一列相同 则把第三列的合并为一行 最终结果为
1 489168 AT5G23110.1 Carubv10000018m Thhalv10003499m Bra013017 Tp2g24010
2 355042 AT4G17140.3 Carubv10006303m Thhalv10024176m Bra021067 Tp7g17050
3 473945 AT1G48090.1 Carubv10012395m Thhalv10011170m Bra014101 Tp1g35040
shell
awk '{a[$1]=a[$1]?a[$1]" "$3:$3}END{for (i in a) print i,a[i]}' file