Find the only string name based on the sub string name in a file.
Command used:
cat test.xml | grep -i current | awk -F / '{print $NF}' | tr -d
What works:
File content:
<Context path="/SomeApi" reloadable="false" docBase="http://some-domain/CURRENT/SomeApi-CURRENT.war"
Output (desired output):
SomeApi-CURRENT.war
What does not work:
File content:
<Context path="/SomeApi" reloadable="false" docBase="http://some-domain/CURRENT/SomeApi-CURRENT.war" workDir="/U01/someApi/work
Output:
work className=URLStandardContext unpackWAR=true>
Need output SomeApi-CURRENT.war