Re: How to find a .class file in a bunch of JARs?
Owen Jacobson wrote:
On Aug 7, 11:32??am, Nigel Wade <n...@ion.le.ac.uk> wrote:
laredotornado wrote:
On Aug 6, 2:36??pm, Owen Jacobson <angrybald...@gmail.com> wrote:
On Aug 6, 4:13??pm, laredotornado <laredotorn...@zipmail.com> wrote:
Hi,
I'm on Solaris 9. ??Does anyone know of a way to search through JAR
files (all of which are in the same directory) to find a class
"my.class" without having to unzip each file?
Thanks, - Dave
grep -l foo/bar/my.class *.jar
-o
I like the one-lineness of this solution, but when I try it, I'm
getting no results. ??Maybe I'm doing something wrong. ??In a JAR file,
I have the class com.myco.nps.im.gui.utils.NPSIMPropertiesMgr.class
but when I execute the command from within my WEB-INF/lib directory
grep -l com/myco/nps/im/gui/utils/NPSIMPropertiesMgr.class *.jar
I get nothing. ??Am I doing something wrong with the above? -
grep on Solaris [2.7] doesn't like binary files.
I learn something new every day.
The approach I use has always served me well on OS X (BSD) and Linux,
so it's doubly surprising that Solaris grep doesn't handle it.
SunOS/Solaris is an old OS, with a long tradition of backwards compatibility.
Many of the traditional UNIX tools date back decades, and their behaviour is
entrenched so as not to break existing code. In Solaris the default application
will be the traditional one. There may be others which conform to later
standards (for example Solaris 2.7 includes an XPG4 version of grep). A later
version of grep, egrep, was introduced which incorporates many additions (most
notably use of "extended" regular expressions, hence the name). egrep seems to
handle binary files much better.
The newer OS, such as Linux, don't have the tradition or necessity of backward
compatibility and hence use egrep as grep. I'm surprised that BSD has
supplanted grep with egrep, or maybe that is just an Appleism - they are not
exactly noted for backward compatibility in anything.
--
Nigel Wade