Re: How to find a .class file in a bunch of JARs?



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
.



Relevant Pages

  • Re: Set App Priority
    ... string and then terminates" ... gives then parameters to use to modify the START command ... below) /F:OFF Disable file and directory name completion characters ... no special characters between the two quote characters, ...
    (microsoft.public.windowsxp.customize)
  • Re: Set App Priority
    ... This would start notepad with high priority. ... Starts a new instance of the Windows XP command interpreter ... /F:OFF Disable file and directory name completion characters ... If all of the following conditions are met, then quote characters ...
    (microsoft.public.windowsxp.customize)
  • Re: DOS Box Keyboard problem
    ... I get 437 from command chcp and cmd chcp. ... When in the cmd box I can type with all characters OK ... The OEMCP value controls to which OEM code page to translate ANSI, ...
    (microsoft.public.windowsxp.configuration_manage)
  • Re: Cannot delete file with name ended with a dot.
    ... receive the message "File Not Found" (from command prompt I cannot see the ... The operating system is Windows 2008 server standard x64. ... A little background on undeletable files and folders: ... files to it but use characters in the name that FTP supports (ASCII ...
    (microsoft.public.windows.server.general)
  • Re: [PATCH] USB: add USB test and measurement class driver - round 2
    ... accumulated (or until zero characters are returned, ... This logic should be done in userspace, ... a measurement command it is not known how many bytes it will return. ... handle this as a warning telling the user that he did not request all ...
    (Linux-Kernel)