count word occurrences 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
$ grep -o -i needs inspire.txt | wc -l
Just use flag -m to define number of occurrences to match:
grep -m1 pattern file