awk '{arr[$1]=arr[$1] " " $2}END{for( i in arr){print i,arr[i]}}' edgelist.txt | sort -k1 On Fri, Dec 10, 2010 at 4:20 PM, profaar <profaar at live.com> wrote: > 1 2 > 1 3 > 1 4 > 1 5 > 2 3 > 2 4 > 3 2 > 4 1 > 4 3 > 4 5 > 5 2 > 5 4