2

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
sorin
  • 161,544
  • 178
  • 535
  • 806

2 Answers2

0

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)

Francois G
  • 11,957
  • 54
  • 59
0

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
Dr. Alex RE
  • 1,772
  • 1
  • 15
  • 23