In response to a curl command curl -ik -u max:pass -X GET -i -H "Content-Type: application/xml" https://1.2.3.4:943/cloud/rest/projects
I get a huge xml with many entires similar to the following
<project xlink:href="https://1.2.3.4:943/cloud/projects/13389/" >
<approvedservers xlink:href="https://1.2.3.4:943/cloud/projects/13389/approvedservers/" ></approvedservers>
<requestUser>maxadmin</requestUser>
<removed xlink:href="https://1.2.3.4:943/cloud/projects/13389/removed/" ></removed>
<rejected>false</rejected>
<pending xlink:href="https://1.2.3.4:943/cloud/rest/projects/13389/pending/" ></pending>
<name>4BSm3ZQ1T6q7xBR2xT2PdQ</name>
<servers xlink:href="https://1.2.3.4:943/cloud/rest/projects/13389/servers/" ></servers>
<ticketId>ticketId</ticketId>
<approved>true</approved>
<history xlink:href="https://1.2.3.4:943/cloud/rest/projects/13389/history/" ></history>
<startTime>1502214154651</startTime>
<requestedServerCount>1</requestedServerCount>
<applicationid>4336525</applicationid>
<provision>provision</provision>
<customer>None</customer>
<endTime>253402300740000</endTime>
</project>
How can I parse this output to fetch project ID which is same in all the urls https://1.2.3.4:943/cloud/rest/projects/13389/pending/
based on the <name>4BSm3ZQ1T6q7xBR2xT2PdQ</name>
. Basically I want to find the project id for a user name.