Use the -o
flag:
-o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
For example grep -ro "TODO" chapters/*.tex | wc -l
Use the -o
flag:
-o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
For example grep -ro "TODO" chapters/*.tex | wc -l