Re: How to find a .class file in a bunch of JARs?
- From: Owen Jacobson <angrybaldguy@xxxxxxxxx>
- Date: Fri, 8 Aug 2008 09:58:49 -0700 (PDT)
On Aug 8, 9:57 am, maaxiim <maax...@xxxxxxxxx> wrote:
On Aug 7, 9:36 pm, "John B. Matthews" <nos...@xxxxxxxxxxxxxx> wrote:
In article <YhMmk.9707$L_.7...@xxxxxxxxxxxxxxxxxxxx>,
Mark Space <marksp...@xxxxxxxxxxxxxx> wrote:
find $JAVA_HOME/lib -name \*jar -exec jar tf {} \; 2>&1 | grep whatever
Nice! The find command is awesome and often overlooked. On my system
however this doesn't print the names of files, just the names of the
class you looked for. This is a bit sneakier:
find <path> -name \*jar -exec strings -f {} \; grep search_string
This will also print a line if the path name matches too... maybe look
for characters following a : ...
find <path> -name \*jar -exec strings -f {} \; egrep :.+search_string
Kewl, er, I mean exemplary! My strings doesn't have -f, but xargs will
echo the path name with -t:
find <path> -name \*jar -print0 | xargs -t jar tf | grep ...
<pedantic>
'find' is definitely a must in the programmer toolbox, but there's a
little gotcha that I wanted to bring up here;
It's generally better to use the
{grep <pattern> `find <path> -name <filename-pattern> -print`}
Beware of tokenizing issues with this kind of command. Consider:
~/spacecase $ touch a\ b
~/spacecase $ touch c
~/spacecase $ find .
.
./a b
./c
~/spacecase $ touch `find . -print` # using touch to illustrate
problem
~/spacecase $ find .
.
./a
./a b
./b
./c
This is probably a more common issue on Mac OS, where spaces are
normal, than on solaris, where spaces are supported but unusual.
-o
.
- Follow-Ups:
- Re: How to find a .class file in a bunch of JARs?
- From: Mark Space
- Re: How to find a .class file in a bunch of JARs?
- References:
- How to find a .class file in a bunch of JARs?
- From: laredotornado
- Re: How to find a .class file in a bunch of JARs?
- From: Owen Jacobson
- Re: How to find a .class file in a bunch of JARs?
- From: laredotornado
- Re: How to find a .class file in a bunch of JARs?
- From: Nigel Wade
- Re: How to find a .class file in a bunch of JARs?
- From: John B. Matthews
- Re: How to find a .class file in a bunch of JARs?
- From: Mark Space
- Re: How to find a .class file in a bunch of JARs?
- From: John B. Matthews
- Re: How to find a .class file in a bunch of JARs?
- From: maaxiim
- How to find a .class file in a bunch of JARs?
- Prev by Date: Re: how to set (preferred) JSlider length?
- Next by Date: Creating a simple visual user interface
- Previous by thread: Re: How to find a .class file in a bunch of JARs?
- Next by thread: Re: How to find a .class file in a bunch of JARs?
- Index(es):
Relevant Pages
|