I have a sorted file like:
Apple 3
Apple 5
Apple 8
Banana 2
Banana 3
Grape 31
Orange 7
Orange 13
I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found.
so the output would look like:
Apple 8 3
Banana 3 2
Grape 31 1
Orange 13 2
I'm very new and don't have any useful code suggestions. I would guess the logic should be about counting and then comparing the count to the previous count.