Take the 2-minute tour ×

I am looking for a command that would work like grep -r sometext . but that will know to look inside archives (at least .jar).

Extra bonus ;) if we can make it ignore directories like .svn .hg.

share|improve this question
add comment

1 Answer

The low-tech solution:

find . -name "*.jar" -exec jar tf '{}' \| grep -H "SearchTerm" \;

If you do that sort of thing often, consider replacing grep with ack (plus it does avoid version control directories by default)

share|improve this answer
ack won't look inside .jar files, though. Plugins to handle them are on deck for ack 2.1, though. –  Andy Lester May 11 '12 at 22:41
add comment

Your Answer


