0

I have a directory containing a vast amount of xml files. I would now like to find the number of files (and optionally the names of said files) that contain a certain string. XML tags do not really matter, each of the files can be seen as text files.

I have found a similar question here, but this will output the whole file content. I am only interested in the filenames and the number of files that contain the given string.

1 Answer 1

0

Here are commands run from inside the directory.

number of files:

grep -l text *.xml |wc -l

file names:

grep -l text *.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.