title: Get attribute value from xml tags with shell script and convert to csv
body: <p><strong>The task:</strong></p>
  
  <p>I'm trying to get the attribute-value from xml tags with a shell script, split the value up and save them in a .csv-file.</p>
  
  <p>This is how the xml looks like:</p>
  
  <pre><code>&lt;host&gt;
    &lt;servers&gt;
      &lt;server name="Type1Name1-Port1" &gt;...&lt;/server&gt;
      &lt;server name="Type2Name2-Port2" &gt;...&lt;/server&gt;
      &lt;server name="Type3Name3-Port3" &gt;...&lt;/server&gt;
      ...
      &lt;server name="TypexNamex-Portx" &gt;...&lt;/server&gt;
    &lt;/servers&gt;
  &lt;/host&gt;
  </code></pre>
  
  <p>I'd like to get the values from the "name"-attribute and split them up like following:<br>
  <code>Type;Name;Port</code></p>
  
  <p>The output csv file I want should look like this:</p>
  
  <pre><code>Type1;Name1;Port1
  Type2;Name2;Port2
  Type3;Name3;Port3
  ...
  Typex;Namex;Portx
  </code></pre>
  
  <p><strong>The problem:</strong></p>
  
  <ul>
  <li>I can't install anything on the server</li>
  <li>I can only use "ksh-awk" / "xmllint wihtout --xpath" / "standard linux commands"</li>
  </ul>
  
  <p>I can use any shell-language I want to. I prefer bash and ksh.</p>
  
  <p><strong>My questions:</strong></p>
  
  <ul>
  <li>Do you think it is possible to solve my task?</li>
  <li>What is the best approach for the sub-tasks? (reading, splitting, writing)</li>
  </ul>
  
  <p><strong>EDIT:</strong></p>
  
  <p><strong>Example data of a server-name:</strong></p>
  
  <p>T-TTT_AAA-A-SSS-PPPP</p>
  
  <p>Where T represents the Type, A the Applicationname, S the Server-Name, P the Port. The length of T, A and S are variable. P is constant.</p>