I have multiple files in multiple directories, and I need a grep command which can return the output only when both the patterns are present in the file. The patterns are like AccessToken
and Registrationrequest
. The patterns are not in the same line. AccessToken
can be in one line and Registrationrequest
can be in another line. Also search the same recursively across all files in all directories.
Tried
grep -r "string1” /directory/file | grep "string 2”
grep -rl 'string 1' | xargs grep 'string2' -l /directory/ file
grep -e string1 -e string2
Nothing works
Can anyone please help?