title: Looping over pairs of values in bash
body: <p>I have 10 text files and I want to <code>paste</code> each file with its pair, such that I have 5 total files.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>for i in 4_1 5_1 6_1 7_1 8_1
  do
  for j in 4_2 5_2 6_2 7_2 8_2
  do
  paste ${i}.txt ${j}.txt &gt; ${i}.${j}.txt
  done
  done
  </code></pre>
  
  <p>However, this code combines every possible combination instead of just combining the matching pairs.</p>
  
  <p>So I would like file <code>4_1.txt</code> to be paired with <code>4_2.txt</code>, <code>5_1.txt</code> with <code>5_2.txt</code>, etc.</p>