I am normally searching like this

grep -rnws '/path/to/directory/' -e 'JMSAppender'

However this does display all jar files and class files where it might be used. I need to check only inside log4j properties in each projects.

Is there anyway to grep only properties files inside certain directories?

1 Answer 1


Assuming you’re using GNU grep, you can specify globs to match against with --include:

grep -rnws --include '*.properties' '/path/to/directory/' -e 'JMSAppender'

The pattern must be quoted to ensure the shell doesn’t try to process it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .