I would like to (recursively) find all files with "ABC" in their file name, which also contain "XYZ" in the file. I tried:
find . -name "*ABC*" | grep -R 'XYZ'
but its not giving the correct output.
|
That's because
From
If you don't need the actual matching lines but only the list of file names containing at least one occurrence of the string, use this instead:
|
|||||||||||||
|
On Mac OS X or BSD,
GNU What you meant to do was probably
… which is similar to
… both of which tell Note, however, that any whitespace in the filenames will cause those two commands to break. You can use
But @terdon's solution using |
|||
|