I need to get an attribute from an xml file in a bash script but I can't use neither xmllint --xpath neither xmlstarlet cause they are not available on the server where I work.
I've tried solution with grep, cut and sed but it's not a good solution in a long time.
There is grep_xml available on the machine, I can acces elements with it but when I'm trying to access my attribute I get "error unrecognized expression in handler"
this is my xml file
<?xml version="1.0" standalone="yes"?>
<p4codeline xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="p4codeline_1_1.xsd">
<module name="kpreader" currentVersion="kpreader_1.1STD0" previousVersion="kpreader_1.0STD0">
<codeline owner="undefined" path="//HEP/jcas/kpreader/trunk/...">
<namingConvention/>
<description>Main codeline for development</description>
<rules>
<rule>Develop on MAIN, and create a TAG codeline on release</rule>
<rule>Never broke the build on the MAIN</rule>
</rules>
</codeline>
<externals>
<external viewPath="J2ep_BuildTools/..." codeLine="//CT/JAVA/J2ep_BuildTools/Source/tags/J2EP_BUILDTOOLS_1.6STD0/..." depotPath="."/>
</externals>
</module>
</p4codeline>
and i would need to access to the path attribute in codeline only with a solution based on bash or command.
I've tried something like
xml_grep -t '/p4codeline/module/codeline/@path' file.xml
And it answear me
error: unrecognized expression in handler: '/p4codeline/module/codeline@path' at /usr/bin/xml_grep line 183