I\'m using grep to match string in a file. Here is an example file:
example one, example two null, example three, example four null,
grep
use grep -n -i null myfile.txt to output the line number in front of each match.
grep -n -i null myfile.txt
I dont think grep has a switch to print the count of total lines matched, but you can just pipe grep's output into wc to accomplish that:
grep -n -i null myfile.txt | wc -l