Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My application is built on Java EE.

I have approximately 50 jars in this application.

Is it possible to search for a particular keyword (actually I want to search for a keyword BEGIN REQUEST)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
111 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can use zipgrep on Linux or OSX:

zipgrep "BEGIN REQUEST" file.jar

If you wish to search a number of jars, do

find libdir -name "*.jar" -exec zipgrep "BEGIN REQUEST" '{}' ;

where libdir is a directory containing all jars. The command will recursively search subdirectories too.

For windows, you can download cygwin and install zipgrep under it: http://www.cygwin.com/

Edit 1

To view the name of the file that the expression was found you could do,

find libdir -name "*.jar" | xargs -I{} sh -c 'echo searching in "{}"; zipgrep "BEGIN REQUEST" {}'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...