I have the flu but this is no excuse. I am going crazy over this (I’m sure the solution is simple). I got this input file
491 Reynosa
639 JGS-Memphis
5 JGS-Memphis
480 Reynosa
247 JGS-Memphis
556 Reynosa
71 JGS-Memphis
993 Reynosa
5 JGS-Memphis
773 Reynosa
63 JGS-Memphis
589 Reynosa
809 Reynosa
671 Reynosa
397 Reynosa
402 Reynosa
160 Reynosa
612 Reynosa
658 Reynosa
549 Reynosa
691 Reynosa
782 Reynosa
579 Reynosa
I need to do a tally but my code…
awk -F" " '{counts[$2]=counts[$2]+1} END {for (key in counts)
printf "%s\t%d\n", key, counts[key]} ' inputfile.txt
is counting instead of summing…
JGS-Memphis 6
Reynosa 17
I want do something like this
JGS-Memphis 1030
Reynosa ...
what am I missing here??
You were missing a “$”.