I have the following being sent to my command line:
find /base/dir1 /base/dir2 -type f -exec /x/y/z/grep -e lolol -e wow {} +
This returns each file containing one or both of the supplied strings (lolol
and wow
). What I would like to do is to only return the files that contain both strings (AND not OR). If possible how could I accomplish this?
EDIT: The searched strings would need to be present in each file returned but not necessarily on the same line.
EDIT 2: I do not have the -r or -R options
find . -type f -exec grep -q FIND {} \; -exec grep -l ME {} \;
from the accepted answer to the question I linked above will work with any POSIX-compliant implementation offind
andgrep
. – Stephen Kitt Jun 09 '20 at 15:30