Advance FIND Command


 
Thread Tools Search this Thread
Top Forums Programming Advance FIND Command
# 1  
Old 04-23-2010
Advance FIND Command

Hi,

I have to find jar file name and its path by passing it containing class file name, jar is a kind of zip.

by using following command I am able to get jar file name by passing class file name.
Code:
find -name "*.jar" -exec grep "CLASSNAME" {} \;
find -name "*.jar" -exec grep "com/bea/p13n/security/Autentication.class" {} \;

But if the jar file is inside .ear or .war this command is not working
File Structure

EAR -WAR
JAR

WAR - JAR

JAR - class file


can any body help me out this?

Thanks,
Ashish Rai

Last edited by pludi; 04-23-2010 at 06:54 AM.. Reason: code tags, please...
# 2  
Old 04-23-2010
You need a tool like rjar: download it, unzip it, set RJAR_HOME to the directory where you extracted rjar and then:
Code:
find <path> -name '*.[ew]ar' -exec sh -c '
  "$RJAR_HOME"/bin/rjar t "$0" |
    grep <your_pattern> &&
      printf "found in %s\n" "$0"
   ' {} \;

Optionally you can include the rjar's bin directory in your path and invoke it with rjar instead of /path/to/rjar.
# 3  
Old 04-26-2010
I dont have permission to install any software tool, can we inhance the command or write any shell script for this issue
# 4  
Old 04-26-2010
If you are not even allowed to copy a jar file in your home directory,
then, I believe, you'll need to extract the content of the [we]ar file and search inside the extracted files.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Advance conditional grep command

Hi guys, I need your help to use advance grep command, In my example below, I have 5 container which has some information on it, and I need to grep specific word "PLMNCode=454F00" which will not only grep the line contains that word, but I need to print the output for the whole container. Input... (6 Replies)
Discussion started by: hapalon
6 Replies

2. Debian

Squid Advance problem.

Hi There I have a network where im running squid proxy in transparent mode. All sites are blocked by default and the users can only browse sites listed in a file called allowed-sites. I have to block a group of users in department A from accessing 5 sites that the rest of the company can access.... (0 Replies)
Discussion started by: linuxjunkie
0 Replies

3. Shell Programming and Scripting

Advance file parsing...

hi all i have a file of the format Time(starting from 0 in asc order) bytes service flags protocols e.g. 0, 0, 0, 56, 56 1, 524, 3, 6, 75 1, 624, 0, 43, 53 2, 72, 0, 43, 80 3, ... (1 Reply)
Discussion started by: vaibhavkorde
1 Replies

4. Solaris

Advance 2 Days

Hi, Anyone can help me, how to used the advance 2 days? today is : 20090915 i need to get the date : 20090917 in the OS level Thanks, DBM (4 Replies)
Discussion started by: dba_macau
4 Replies

5. UNIX for Advanced & Expert Users

Help needed Urgently... Thanks in advance

You have a file called /opt/test/input.txt with the following information: man_aa_bld_100.410.040_CMD 08/14/2008 23:29:21 08/14/2008 23:31:10 SU 5339491/1 man_aa_bld_100.410.050_CMD 08/14/2008 23:29:21 08/14/2008 23:31:11 SU 5339491/1 man_aa_bld_100.410.060_CMD 08/14/2008 ... (3 Replies)
Discussion started by: jkumsi
3 Replies

6. Shell Programming and Scripting

anyone!! debug this small script..thanks in advance..

x="PermitRootLogin no" cd /etc/ssh y=`cat sshd_config |grep "PermitRootLogin"` if ] then print "Sorry, Remote Root SSH login already disabled." exit else print "Welcome to Remote SSH Login disable script." fi output: + x=PermitRootLogin no + cd /etc/ssh + + cat sshd_config... (2 Replies)
Discussion started by: solaix14
2 Replies

7. UNIX for Advanced & Expert Users

Regarding Advance installation

Hi to all, I have one doubt in unix/linux installation. There are two systems in which one is Sparc system having no CD-Rom, No O/S and fresh Hard disk and another system is having windows O/S. Now, can i install unix or linux o/s in the Empty Sparc System by using other system which is... (1 Reply)
Discussion started by: sasidarvarma
1 Replies

8. Shell Programming and Scripting

Advance string pattern search Please

Here is my problem.. 1. I want to search all those files with file name starting AJ128**** (in all the sub directories also) 2. I want to search for the follwoing type of string line beging with string - 'AK*any_1_char*any_2_char*510' 3. I need to display list of file names... (2 Replies)
Discussion started by: sainj
2 Replies

9. Shell Programming and Scripting

A more advance Alias

Hey all, I want to go ahead and create a alias for the command /bin/passwd. But I want to do this so that it will/can detect if the -r option is added to the command as well...Can this be done... For example if the user enters: # passwd --> Alias will issue /bin/passwd -r # passwd -r... (0 Replies)
Discussion started by: msbutton27
0 Replies
Login or Register to Ask a Question