count words using grep code example
Example 1: grep count lines
cat myfile | wc -l
Example 2: count occurrences of word in file linux ignoring case
$ grep -o -i needs inspire.txt | wc -l
Example 3: grep count lines
grep -c ^ filename
cat myfile | wc -l
$ grep -o -i needs inspire.txt | wc -l
grep -c ^ filename