I have a tab delimitated file with multiple columns. I'd like to extra the number of times I see something in column A and print the data associated with the value in column A in a new column B.
1 blue 1 green 1 red 100 blue 100 red
I'd like an output file that reads
3 1 blue,green,red 2 100 blue,red
Is there away to do this using awk or perl?