I have a text file that looks like:
1 aaaa
2 bbbb
3 cccc
4 dddd
2 eeee
2 ffff
4 gggg
I would like to map these into some sort of associative array so that I can access, for example, all the values associated with the key 2 and all the values associated with the key 4, etc.:
1->aaaa
2->bbbb,eeee,ffff
3->cccc
4->dddd,gggg
I haven't been able to figure out how to do this with 'declare -A MYMAP'. Is there some easy way to do this?
--------update--------
my key/value pairs look like this actually:
bb126.B1 bb126.1.ms.01
bb126.B2 bb126.1.ms.02
bb126.B3 bb126.1.ms.03
bb126.B4 bb126.1.ms.04