title: Bash: replace matching regex with nth line from another file
body: <p>I have two files.</p>
  
  <p>File one is a TXT and contains strings, one per line.</p>
  
  <p>File two is a XML with several entries like this:</p>
  
  <pre><code>&lt;data name="Btn:Cancel" xml:space="preserve"&gt;
      &lt;value&gt;Cancel&lt;/value&gt;
      &lt;comment&gt;Original English: Cancel&lt;/comment&gt;
    &lt;/data&gt;
  </code></pre>
  
  <p>I need to replace the VALUE value in the XML file with the corresponding string from file one: So the first occurrence of VALUE would be replaced by the first line from the file one, the second occurrence of VALUE in the XML file would be replaced by the second line from file one, and so on.</p>
  
  <p>I've tried several things (basically using sed) and my last shot was</p>
  
  <pre><code>while read line           
  do
      echo $count
      echo $line
      sed "s_&lt;value&gt;.*&lt;/value&gt;_&lt;value&gt;$line&lt;/value&gt;_$count" file.xml &gt; results.xml
      ((count++))
  done &lt; file.txt
  </code></pre>
  
  <p>But it does nothing on the results.xml file :(</p>