Skip to the content.

Grep Count Matches

To print count matching lines we can use -c, --count argument with grep command.

Example

$ seq 100 | grep -c 5
19

Source: Linuxize