I have a text file that looks like:
1 aaaa 2 bbbb 3 cccc 4 ffffdd 2 eeee 2 ffff 4 gggg
I would like to map these into some sort of associative ar
The below script is for comma separated value, you can change as per your need
awk -F "," '{OFS=","} 1 {if (a[$1]) {a[$1] = a[$1]" "$2} else {a[$1] = $2}} END {for (i in a) { print i,a[i]}}' input_file > Output_file