When searching for number of occurrences of a string in a file, I generally use:
grep pattern file | wc -l
However, this only finds one occurrence per line, because of the way grep works. How can I search for the …
I would like to grep for a string, but also show the preceding five lines and the following five lines as well as the matched line. How would I be able to do this?