title: BASH reading data from XML and copying it to certain fields in a text file
body: <p>I have a specific problem where I can't seem to find the solution to.
  I have two files. An XML file and a text file.</p>
  
  <p>Snippet from XML file below:</p>
  
  <pre><code>&lt;furnidata&gt;
  &lt;roomitemtypes&gt;
  &lt;furnitype id="13" classname="shelves_norja"&gt;
  &lt;revision&gt;61856&lt;/revision&gt;
  &lt;defaultdir&gt;0&lt;/defaultdir&gt;
  &lt;xdim&gt;1&lt;/xdim&gt;
  &lt;ydim&gt;1&lt;/ydim&gt;
  &lt;partcolors&gt;
  &lt;color&gt;#ffffff&lt;/color&gt;
  &lt;color&gt;#F7EBBC&lt;/color&gt;
  &lt;/partcolors&gt;
  &lt;name&gt;Boekenkast&lt;/name&gt;
  &lt;description&gt;Bewaar hier je frutsels en kunstboeken&lt;/description&gt;
  &lt;adurl/&gt;
  &lt;offerid&gt;5&lt;/offerid&gt;
  &lt;buyout&gt;1&lt;/buyout&gt;
  &lt;rentofferid&gt;-1&lt;/rentofferid&gt;
  &lt;rentbuyout&gt;0&lt;/rentbuyout&gt;
  &lt;bc&gt;1&lt;/bc&gt;
  &lt;excludeddynamic&gt;0&lt;/excludeddynamic&gt;
  &lt;customparams/&gt;
  &lt;specialtype&gt;1&lt;/specialtype&gt;
  &lt;canstandon&gt;0&lt;/canstandon&gt;
  &lt;cansiton&gt;0&lt;/cansiton&gt;
  &lt;canlayon&gt;0&lt;/canlayon&gt;
  &lt;furniline&gt;iced&lt;/furniline&gt;
  &lt;/furnitype&gt;
  </code></pre>
  
  <p>Snippet from text file below:</p>
  
  <pre><code>["20_credits","20 Credits",""],["220c_100d","50 procent korting op 220 Credits","220 credits en diamanten voor de prijs van 110 credits! Aanbieding is 48 uur beschikbaar en beperkt tot √©√©n per persoon."],["22_credits","22 Credits",""],["25credit_prize_14","25 Credits!",""],["2credit_prize_14","2 Credits!",""],["3-giveaway3","3-giveaway3",""]
  </code></pre>
  
  <p><strong>My problem:</strong>
  It is my intention to copy each <strong>classname=""</strong> from the XML file to the first <strong>""</strong> between each <strong>[]</strong> where the name and description from the XML match the name (second "") and description (third "") from the text file. The problem is that some names and descriptions come twice or more. For example the combination "Boekenkast" and "Bewaar hier je frutsels en kunstboeken" comes a total of 7 times each with a different classname. </p>
  
  <p>The XML is sorted by id, yet the text file is completely mixed up.</p>
  
  <p>Any idea how to approach this with bash? I'm far from a scripting prodigy.</p>
  
  <p>In case I wasn't clear enough explaining it here feel free to leave a reaction, I will update my question immediately. </p>