title: Store Tags of XML File in an Array Using Shell Script
body: <p>I have an XML file of the format:</p>
  
  <pre><code>&lt;classes&gt;
  
   &lt;subject&gt;
    &lt;name&gt;Operating System&lt;/name&gt;
    &lt;credit&gt;3&lt;/credit&gt;
    &lt;type&gt;Theory&lt;/type&gt;
    &lt;faculty&gt;Prof. XYZ&lt;/faculty&gt; 
   &lt;/subject&gt;
  
   &lt;subject&gt;
    &lt;name&gt;Web Development&lt;/name&gt;
    &lt;credit&gt;3&lt;/credit&gt;
    &lt;type&gt;Lab&lt;/type&gt;
   &lt;/subject&gt;
  
  &lt;/classes&gt;
  </code></pre>
  
  <p>I want to store the tag names i.e. name, credit, type, faculty in an Array using Shell Script.</p>
  
  <p>I tried using <code>awk</code> command as:</p>
  
  <p><code>awk -F'[&lt;&gt;]' '/&lt;name&gt;|&lt;credit&gt;|&lt;type&gt;|&lt;faculty&gt;/{print $2}' file.xml</code></p>
  
  <p>But it's returning values as:</p>
  
  <pre><code>name
  credit
  type
  faculty
  name
  credit
  type
  </code></pre>
  
  <p>How to store these results in an array?</p>