Search code examples
linuxbashunixgrepwar

Get a value from xml file inside a war file without extracting


I want to read a line from a jsp file present in my war file. The path of the jsp file is always the same, so I know where exactly to look for. How do I grep the line from the jsp inside the war file, without extracting the whole war file? I don't want to extract because it would take at least couple of minutes to finish, and I just want to get the version value (1.2.3.210) from that line. This is how the structure looks like -

war file name --> final.war 
jsp location inside the war file --> folder1/folder2/version.jsp
line inside the jsp file --> <param><value>version=1.2.3.210</value></param>

Solution

  • This worked for me. I did not have to install jar, as it was already available in CentOS

    jar -xf final.war folder1/folder2/version.jsp