Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

looking for unix program to search some keywords in side EAR WAR and JAR files

Hi,

I am looking for unix program to search some keywords(say "hello", "world" etc) in side EAR file (say xyz.EAR) which has a  WAR file(say abc.war) and has JAR files(like def.jar, ghi.jar).

I have installed cygwin and MobaXTerm already. Please advise
ASKER CERTIFIED SOLUTION
Avatar of Abhimanyu Suri
Abhimanyu Suri
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

any sample shell script for this?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If the file in the jars are compressed (in which way ever) the only way
would be to unpack the archives (hierarchally where needed) and
scan the resulting diretory tree afterwards
To give you some idea: Scan all files in current directory tree, try something like
cd <top-level-directory>
strings `find * -type f` | grep -i hello 

Open in new window

Avatar of gudii9

ASKER

how to search multiple words about 100 same time and generate some text report? any sample shell script to this. if i search hello it should not find helloall as well.  Needs to be correct match
Use grep in the right way no NOT match helloxyz, only hello as a single word
Something like:
grep -i '[ ^]hello[$ ]'

Open in new window

Read how to use (and compose) regular expresiions for grep to accomplish this.

To put all this into a file:
strings `find * -type f` | grep -i hello > report.txt 2>&1 

Open in new window

Using Perl regex (depending on what version of grep you have) is easier

grep -iP '\bhello\b'

Open in new window

... as you say "depending on grep version".
Your man page(s) for grep should shed light on this.
Sorry - how does the 'Accepted Solution' answer the question in any way?