title: How can I extract text from between two xml tags using sed
body: <p>I have the following output from curl:</p>
  
  <pre><code>&lt;env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'&gt;&lt;env:Header&gt;&lt;/env:Header&gt;&lt;env:Body&gt;&lt;ns3:getNodesResponse xmlns:ns3='http://node.sdk.nms.ov.hp.com/'&gt;&lt;return&gt;&lt;item&gt;&lt;created&gt;2016-01-12T18:04:44.617Z&lt;/created&gt;&lt;deviceCategory&gt;com.hp.ov.nms.devices.other&lt;/deviceCategory&gt;&lt;deviceDescription&gt;No Device Profile found for this device. The assigned SNMP OID is the top of a Opto 22 subtree&lt;/deviceDescription&gt;&lt;deviceFamily&gt;com.hp.ov.nms.devices.opengear&lt;/deviceFamily&gt;&lt;deviceModel&gt;Opengear Generic&lt;/deviceModel&gt;&lt;deviceVendor&gt;com.hp.ov.nms.devices.opengear&lt;/deviceVendor&gt;&lt;discoveryState&gt;DISCOVERY_COMPLETED&lt;/discoveryState&gt;&lt;endNode&gt;false&lt;/endNode&gt;&lt;&gt;false&lt;/IPv4Router&gt;&lt;id&gt;330742910324&lt;/id&gt;&lt;lanSwitch&gt;false&lt;/&gt;&lt;longName&gt;xxxxxxxxxxxxxxxxx&lt;/longName&gt;&lt;managementMode&gt;MANAGED&lt;/managementMode&gt;&lt;modified&gt;2016-06-21T19:46:38.837Z&lt;/modified&gt;&lt;name&gt;xxxxxxxxxxxxxxx&lt;/name&gt;&lt;notes&gt;&lt;/notes&gt;&lt;snmpSupported&gt;true&lt;/snmpSupported&gt;&lt;snmpVersion&gt;V2C&lt;/snmpVersion&gt;&lt;status&gt;NORMAL&lt;/status&gt;&lt;systemContact&gt;Unspecified (Management Console -&amp;gt; Alerts &amp;amp; Logging -&amp;gt; SNMP)&lt;/systemContact&gt;&lt;systemDescription&gt;Linux xxxxx 3.10.0-uc0 #1 Mon Dec 21 16:21:01 EST 2015 armv4tl&lt;/systemDescription&gt;&lt;systemLocation&gt;Unspecified (Management Console -&amp;gt; Alerts &amp;amp; Logging -&amp;gt; SNMP)&lt;/systemLocation&gt;&lt;systemName&gt;xxxxxx&lt;/systemName&gt;&lt;systemObjectId&gt;.1.3.6.1.4.1.25049.1.81&lt;/systemObjectId&gt;&lt;uuid&gt;e3a77c1c-ab82-4dfb-b7bf-78e1dadef888&lt;/uuid&gt;&lt;/item&gt;&lt;/return&gt;&lt;/ns3:getNodesResponse&gt;&lt;/env:Body&gt;&lt;/env:Envelope&gt;
  </code></pre>
  
  <p>How can I retrieve the text between <code>&lt;id&gt;</code> and <code>&lt;/id&gt;</code>? I tried using:</p>
  
  <pre><code>sed -e 's/&lt;id&gt;\(.*\)&lt;\/id&gt;/\1/'
  </code></pre>
  
  <p>but that results in the entire block of text being printed out instead of just the part between  and &lt;\id>.</p>
  
  <p>I don't have the ability to install programs on this box so I'd rather not go through the hassle of manually compiling xmlstarlet, etc, just to extract this one thing. </p>