title: Iterate over two items in bash
body: <p>Given a file <code>integers</code> that contains integers separated by new lines. For instance:</p>
  
  <pre><code>1
  39
  77
  109
  137
  169
  197
  229
  261
  293
  </code></pre>
  
  <p>One can iterate over the file using the following code:</p>
  
  <pre><code>while read a
  do
      echo "$a"
  done &lt; integers
  </code></pre>
  
  <p>I'm looking however for an elegant solution such that the loop takes two integers at once and always updates by one step, such that:</p>
  
  <pre><code>while #some funny commands
  do
      echo "$a | $b"
  done &lt; integers
  </code></pre>
  
  <p>results in:</p>
  
  <pre><code>1 | 39
  39 | 77
  77 | 109
  109 | 137
  137 | 169
  169 | 197
  197 | 229
  229 | 261
  261 | 293
  </code></pre>