grep get count of matches 1

grep get count of matches

grep -o '' fileName | wc -l

Here is what the above code is Doing:
1. grep -o ‘‘ fileName
-o means only print the matching part of the line
‘ is the string you’re searching for
fileName is the file you’re searching in
2. wc -l
wc is the word count command
-l means only print the number of lines

Similar Posts