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
.
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)
To search in archives (e.g. zip, tar, pax, jar) the open source ugrep tool with option -z
does exactly that:
ugrep -z "sometext" file.jar