Find a file in group of jars


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find a file in group of jars
# 1  
Old 07-27-2011
Question Find a file in group of jars

Hi,

Code:
jar -tvf tools.jar | grep LinkInfoImpl

Output:
Code:
  4968 Fri Feb 22 02:34:52 EST 2008 com/sun/tools/doclets/formats/html/LinkInfoImpl.class

However, i need the similar output for all jar files under /apps/lib/ directory and its subdirectories.

Can you please help format my command to achieve the mentioned ?

Regards,
Mohtashim

Last edited by radoulov; 07-27-2011 at 12:30 PM.. Reason: Code tags.
# 2  
Old 07-27-2011
Do you need to know which jar it came from?
# 3  
Old 07-27-2011
I suppose you could do something like

Code:
 
for i in `find /apps/lib/ -name *.jar`; do jar -tvf $i | grep LinkInfoImpl; done

or

Code:
 
find /apps/lib/ -name *.jar -exec jar -tvf {} \; | grep LinkInfoImpl


You'll have to modify them a bit if you want to know what jar file each is in (and I assume that's something you'd want) as this will not give you that.
# 4  
Old 07-28-2011
Yes your solution works and Yes you are right that i need the jar name and the path which populated my grep string.

Below is the current output:

find /apps/wls/bea10/jdk160_05/ -name *.jar -exec jar -tvf {} \; | grep LinkInfoImpl


4968 Fri Feb 22 02:34:52 EST 2008 com/sun/tools/doclets/formats/html/LinkInfoImpl.class

I am still naive to figure out how to get the jar name and its path. Can you or someone help?

Also if I wish to look for *.ear, *.war along with *.jar at the same time how would I ?

Regards,
Mohtashim

Last edited by mohtashims; 07-28-2011 at 09:54 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Finding a way to load appropriate jars in different OSs as per requirement.

Hi All, This discussion involves getting a way to load different jars in different Operating Systems. Case Scenario --------------- I am working on a specific OS known as NSK. Its an unix flavour and powers the HP NSK Servers. I am running one of my middleware app ( a java application) on... (3 Replies)
Discussion started by: Pabi
3 Replies

2. Red Hat

How to find Secondary Group only?

Hi, I would like to know how to find our secondary group of user only. I have used the command id -Gn user1 it is showing both groups of user. Primary and secondary group. (2 Replies)
Discussion started by: manoj.solaris
2 Replies

3. UNIX for Dummies Questions & Answers

How to create a volume group, logical volume group and file system?

hi, I want to create a volume group of 200 GB and then create different file systems on that. please help me out. Its becomes confusing when the PP calculating PP. I don't understand this concept. (2 Replies)
Discussion started by: kamaldev
2 Replies

4. Shell Programming and Scripting

Find a group of result and print last hits

Hi I would like to search some data with awk and then print the last of the hits. Find house and print last value input:red house 4 blue boat 2 green house 6 black car 7 output:6 I now how to search using /house/, print third field print $3, an now I may use some form of $NR to get the... (3 Replies)
Discussion started by: Jotne
3 Replies

5. Shell Programming and Scripting

need a one liner to grep a group info from /etc/group and use that result to search passwd file

/etc/group tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root /etc/passwd mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies

6. Red Hat

Repacking a file inside a java archive with nested .jars

Hello, I need to repack a file inside several java archives (nested .jar files) with or without overwrite. I am using a manual approach with mc, but it's painfully slow progress. For example I want to refresh a file deep inside a java archive (with nested .jar files): I have a java... (0 Replies)
Discussion started by: Laurentiu
0 Replies

7. Shell Programming and Scripting

Sort the file contents in each group....print the group title as well

I've this file and need to sort the data in each group File would look like this ... cat file1.txt Reason : ABC 12345-0023 32123-5400 32442-5333 Reason : DEF 42523-3453 23345-3311 Reason : HIJ 454553-0001 I would like to sort each group on the last 4 fileds and print them... (11 Replies)
Discussion started by: prash184u
11 Replies

8. Shell Programming and Scripting

Find a min,group by.

I have a data file with records: A123|Peter|20 A123|Jack |10 B222|Helen|15 B222|Jane |13 B222|Guy |30 I want for find the min for $3 group by $1. i.e A123|Jack|10 B222|Jane|13 Thanks. (4 Replies)
Discussion started by: Shivdatta
4 Replies

9. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

10. UNIX for Advanced & Expert Users

find and group records in a file

Hi, I have this file which has 3 columns, District , stores and unit. What I want is all rows belonging to one district to be created separately under each district, the districts may vary every day , the source file may have 3 districts today and may have 160 tomorrow, so what I need is a... (20 Replies)
Discussion started by: thumsup9
20 Replies
Login or Register to Ask a Question