have this text file:
name, age joe,42 jim,20 bob,15 mike,24 mike,15 mike,54 bob,21
Trying to get this (count):
joe 1 jim 1
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