Linux Example | Grep Count Lines If a String / Word Matches

This linux example code shows how to count lines if a string or word matches in a file using grep command.

The syntax is:

grep -c 'word-to-search' fileNameHere

For example:

grep -c "dfff" test6.txt

You may get:

1