Awk/Unix group by
Strip the header row, drop the age field, group the same names together (sort), count identical runs, output in desired format.
tail -n +2 txt.txt | cut -d',' -f 1 | sort | uniq -c | awk '{ print $2, $1 }'
output
bob 2
jim 1
joe 1
mike 3
$ awk -F, 'NR>1{arr[$1]++}END{for (a in arr) print a, arr[a]}' file.txt
joe 1
jim 1
mike 3
bob 2
EXPLANATIONS
-F,
splits on,
NR>1
treat lines after line 1arr[$1]++
increment arrayarr
(split with,
) with first column as keyEND{}
block is executed at the end of processing the filefor (a in arr)
iterating overarr
witha
keyprint a
print key, arr[a]
array witha
key