Getting the version from jar file

Hi,

I am trying to retrieve the "Implementation version" from one of the .jar file
The command which tried is as below.

find /usr/local/platform  -name "platform.jar" -exec zipgrep "Implementation-Version:" '{}' \;|awk -F ': ' '{print $2}'

I am able to get the version as below

2.9.0-29

But the problem is the above command is not terminating naturally. I have to forcefully exit the command to return to the shell terminal.
On extracting the .jar file there is a MANIFEST file and "Implementation-Version" is written inside the MANIFEST file.Please help in getting the Implementation version from the jar file.

---------- Post updated at 07:34 AM ---------- Previous update was at 07:24 AM ----------

I will abide this rule.It was mistakenly put.

In fact, I don't see a reason your command should not terminate.

  • How big is the subdirectory structure?
  • How many files with that name are scattered within?
  • Is that file REALLY zipped?
  1. Subdirectory under META-INF have many packages
  2. File is getting extracted as per the below output

Apparently , modified the above command by omitting the colon(:slight_smile: symbol as below and the result is having another keyword Implementation-Version outputting in the terminal,again i have to forcefully terminate the command. Will this could be the issue?

find /usr/local/platform  -name "platform.jar" -exec zipgrep "Implementation-Version" '{}' \;|awk -F ': ' '{print $2}'
2.9.0-29
                           <Implementation-Version>${project.version}</Implementation-Version>

---------- Post updated 10-27-17 at 01:15 AM ---------- Previous update was 10-26-17 at 07:51 AM ----------

After some research i modified the script which gets the required information and shell is exiting normally. Thanks


jpath=/home/user/dropbox/platform.jar
unzip -q -c $jpath META-INF/MANIFEST.MF | grep 'Implementation-Version' | cut -d ':' -f2>>testversion.txt

Output
2.9.0-29