Moin,
if you only want to know first, in which files the string appears, you can use the following sample (works only with GNU find!):
Code:
find . -iname '*.jar' -printf "unzip -c %p | grep -q 'Tag read' && echo %p\n" | sh
The
find prints a command line like this:
unzip -c /path/to/something.jar | grep -q 'Tag read' && echo /path/to/something.jar for each found file. This command is piped to a shell. The
-c option of
unzip prints the content to stdout, this output is piped to the
grep. It's
-q option suppresses the normal output and returns immediately with exit code zero, if a line matches.
Jan
EDIT: If you want to know, in which class within the archive the string appears, try this:
Code:
find . -iname '*.jar' -print | while read jar; do
echo "$jar:"
unzip -qq -l $jar | sed 's/.* //' | while read cls; do
unzip -c $jar $cls | grep -q 'Tag read' && echo " "$cls
done
done