title: sed increment number
body: <p>I'd like to substitute some text with an incremental value.
  Considering file xx:</p>
  
  <pre><code>&lt;outro&gt;dfdfd&lt;/outro&gt;
  &lt;RecordID&gt;1&lt;/RecordID&gt;
  &lt;outro&gt;dfdfd&lt;/outro&gt;
  &lt;RecordID&gt;1&lt;/RecordID&gt;
  &lt;outro&gt;dfdfd&lt;/outro&gt;
  &lt;RecordID&gt;1&lt;/RecordID&gt;
  &lt;outro&gt;dfdfd&lt;/outro&gt;
  </code></pre>
  
  <p>and sed command:</p>
  
  <pre><code>for n in seq 3;do sed -e 's/&lt;RecordID&gt;\d/&lt;RecordID&gt;'`echo $n`'/' xx; done
  </code></pre>
  
  <p>the <code>echo $n</code> command does not get incremented.</p>
  
  <p>Tryed also:</p>
  
  <pre><code>n=1; sed -e 's/&lt;RecordID&gt;/&lt;RecordID&gt;'`echo $n ;let n=$n+1`'/g' xx
  </code></pre>
  
  <p>but with no success.</p>
  
  <p>Considering only sed (no awk or perl) how can I have the RecordID field incremented as in:</p>
  
  <pre><code>&lt;outro&gt;dfdfd&lt;/outro&gt;
  &lt;RecordID&gt;1&lt;/RecordID&gt;
  &lt;outro&gt;dfdfd&lt;/outro&gt;
  &lt;RecordID&gt;2&lt;/RecordID&gt;
  &lt;outro&gt;dfdfd&lt;/outro&gt;
  &lt;RecordID&gt;3&lt;/RecordID&gt;
  &lt;outro&gt;dfdfd&lt;/outro&gt;
  </code></pre>