I am running grep -r to look for the context of a word in multiple files.
I am using -r to do it recursively, -i to ignore case and -C to get lines below and above:
grep -r -i -C 10 --group-separator="==========" "29/04/2020" "$dir" >> output.txt
In my output, however, I get the filenames before the match, like:
../data/filename1.txt- (other text)
../data/filename1.txt- 29/04/2020 is the date for etc
../data/filename1.txt- (other text)
==========
../data/different_filename.txt- (other text)
../data/different_filename.txt- something in 29/04/2020
../data/different_filename.txt- (other text)
I would like as output just:
(other text)
29/04/2020 is the date for etc
(other text)
==========
(other text)
something in 29/04/2020
(other text)
Do you know how I could alter the grep -r command to exclude the filepaths?