how to count instances of every name in txt file linux code example
Example 1: count occurrences of word in unix bash
$ grep -o -i needs inspire.txt | wc -l
Example 2: grep ocurrences
Just use flag -m to define number of occurrences to match:
grep -m1 pattern file