I have a pom file that has the following information:
<modelVersion>4.0.0</modelVersion>
<groupId>com.site.camera</groupId>
<artifactId>proj3</artifactId>
<packaging>pom</packaging>
<version>2.6</version>
<name>Proj 3</name>
I am writing a bash script and want to be able to open this file (pom.xml) and cut out the version (eg. 2.6 in this case). I am doing this because as I update the version I want the rest of my script to update with it.
Things that I have tried:
var=$(grep <version>2.6</version> pom.xml)
echo $var
Note that I have multiple version parameters in the pom file. And I need this specific version which is surrounded with this name, packaging, artifactId etc.