title: Two different file references in bash for loops simultaneously
body: <p>Is there a way to use two different file references in for loops simultaneously? Something like:</p>
  
  <pre><code>for file in file1 file2 file3; for name in name1 name2 name3
  do
    awk 'FNR==NR{a[$1];next};($1 in a)' ${file}.txt ${name}.txt &gt; ${name}_extract.txt
  done
  </code></pre>
  
  <p>I tried also with a nested for loop that didn't work:</p>
  
  <pre><code>for file in file1 file2 file3
  do
    for name in name1 name2 name3
    do
      awk 'FNR==NR{a[$1];next};($1 in a)' ${file}.txt ${name}.txt &gt; ${name}_extract.txt
    done
  done
  </code></pre>
  
  <p>What I would like to achieve is to extract lines from 'file1.txt' and 'name1.txt' that match by their first column. Vice versa for file2.txt/name2.txt and file3.txt/name3.txt.  </p>