How can I used grep to find a file containing 2 strings? -
i searching definition of macro in project containing hundreds of source code files.
i sure macros defined in single file.
if grep -r search single macro, on 1000 hits occur.
i search each file, , find files containing both macro names.
can done grep?
for example this:
grep -r "macro1" , "macro2" ./
another way is
grep -rlz 'macro1' ./ | xargs -0 grep -l 'macro2' grep -rlz 'macro1' ./give filenames containingmacro1-zseparate filenames null character
xargs -0 grep -l 'macro2'give filenames containingmacro2
Comments
Post a Comment