Reputation: 11
I have a file like this:
bla AAA 111
bla AAA 222
bla AAA 333
ble BBB 777
ble BBB 555
(...)
and would like to keep the uniq first and second column values while taking the values from the third column and adding them to the first entry seen in the file. The output would look like this:
bla AAA 111 222 333
ble BBB 777 555
(...)
Any hints on how to do this with basic unix/awk command lines?
Thanks a lot!
Upvotes: 1
Views: 44
Reputation: 459
This should work!
awk '{if(!dupli[$3]){A[$1"\t"$2]=A[$1"\t"$2] $3"\t"}}END{for(x in A)print x"\t"A[x]}' file
Upvotes: 1