Issue
I am using the following command on command line for getting the pattern matched lines.
find . -name "*.gz"|xargs gzcat|grep -e "pattern1" -e "pattern2"
i need now to find only the file names where the pattern is present. how can i do it on command line?
grel -l
has no use since i am using xargs gzcat
before grep
Solution
for i in $(find . -name "*.gz"); do gzcat $i|grep -qe "n1" -e "n2" && echo $i; done
Answered By - Timofey Stolbov Answer Checked By - Mildred Charles (WPSolving Admin)