title: Trying to extract from large XML
body: <p>Trying to extract information from a very large .dat file which is in an XML format. It was originally the config file for a PRTG setup, but we are trying to transition to Nagios. The problem is we have over 20k sensors and need to port those over by hand or, if possible, by creating a script that can pull the information out. Unfortunately, i'm still very new to bash, and coding in general, and having a hard time getting a successful script to run. </p>
  
  <p>The current script I have is from the wonderful help of Kusalananda from the unix.stackexchange, but the app i'm using is xmlstarlet which is giving a number of issues / errors. I've recorded the errors in the github page <a href="https://github.com/keyxmakerx/APIDigital/issues/1" rel="nofollow noreferrer">here</a>. Original script <a href="https://github.com/keyxmakerx/APIDigital/blob/master/xmlfinder.sh" rel="nofollow noreferrer">HERE</a>. Hoping someone could help me find a way to extract the information needed out of the .dat file. The example of what is needed is below. The information I need is the host, address, and name. </p>
  
  <pre><code>                     &lt;inherited/&gt;
                        &lt;/flags&gt;
                        &lt;cell&gt;
                          0
                        &lt;/cell&gt;
                      &lt;/force32&gt;
                      &lt;host&gt;
                        192.169.1.1
                      &lt;/host&gt;
                      &lt;httpproxy&gt;
                        1
                      &lt;/httpproxy&gt;
                      &lt;ignoreoverflow&gt;
                        &lt;flags&gt;
                          &lt;inherited/&gt;
                        &lt;/flags&gt;
                        &lt;cell&gt;
                          0
                        &lt;/cell&gt;
                      &lt;/ignoreoverflow&gt;
                      &lt;ignorezero&gt;
                        &lt;flags&gt;
                          &lt;inherited/&gt;
                        &lt;/flags&gt;
                        &lt;cell&gt;
  </code></pre>
  
  <p>**Note, the main file is almost 100k lines. </p>
  
  <p>Also was told this information might be helpful. </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;root version="15" oct="PRTG Network Monitor 17.2.31.1917 x64" 
      saved="5/12/2017 4:36:26 PM" max="184692" guid="{****}" treeversion="0" 
      created="2009-10-02-19-22-11" 
      trial="****"&gt;
      &lt;statistics time="12-05-2017 16:09:19"&gt;
  </code></pre>