title: Trim End of XML API Response in Bash
body: <p>I'm making an XML API request, and then parsing the result to pull out a single value using xmllint. However, the response has a bunch of extraneous text:</p>
  <pre><code>&lt;response&gt;&lt;result&gt;
  &lt;entry&gt;
  &lt;state&gt;init&lt;/state&gt;
  &lt;/entry&gt;
  &lt;/result&gt;&lt;/response&gt;
  
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100  1616  100  1616    0     0   3259      0 --:--:-- --:--:-- --:--:--  3258
  </code></pre>
  <p>Xmllint pulls out the &quot;init&quot; value just like I want, but it only suppresses the XML piece of the response, not that &quot;% Total&quot; junk at the end. Is there any way to remove all of that? As you can tell, it's going to have data that will vary over time, so I can't just slice off the last x characters.</p>
  <p>FYI, I checked the man page for xmllint and nothing seems to be capable of removing this. I tried using &quot;--nsclean&quot; as that was the only switch that seemed capable of doing something like this, and it made no difference.</p>