Reputation: 3199
is there a way to grep(find) the text in a particular file, which is in *.jar and this *.jar is in *.war?
Upvotes: 1
Views: 4159
Reputation: 1403
There is a 'common resource grep' command line tool, crgrep, which searches within various resources including archives, images, pdf, pom file dependencies and arbitrary nested combinations of these. So it will grep nestings such as text within a file in a jar which is buried in a war, within an ear. It also greps db table data and web page/url content.
https://sourceforge.net/projects/crgrep/
I developed crgrep as an opensource tool.
Upvotes: 1
Reputation: 4900
Are you doing this programmatically from Java?
.war files are basically .zip files, just like .jar files. You can open .zip files with java.util.ZipFile.
Open your .war as a ZipFile, find your .jar within it, open your .jar as a ZipFile, find your text file within it. Now you can read the text and process it however you want.
Does this answer your question?
Upvotes: 1
Reputation: 75386
jar files are zip files, so you need a tool that can grep inside a zip file.
It appears there are several at http://www.freedownloadscenter.com/Best/grep-zip.html
Upvotes: 0