title: Replacing with condition on two files awk
body: <p>Using those example:</p>
  <p>File1:</p>
  <pre><code>      rs12124819     1        0.020242          776546 A G
        rs28765502     1        0.022137          832918 T C
         rs7419119     1        0.022518          842013 T G
          rs950122     1        0.022720          846864 G C
  </code></pre>
  <p>File2:</p>
  <pre><code>1_752566    1   0   752566  G   A
  1_776546    1   0   776546  A   G
  1_832918    1   0   832918  T   C
  1_842013    1   0   842013  T   G
  </code></pre>
  <p>I am trying to change the 1st column of file2 with the corresponding 1st column of file1 if their 4th column are equal.</p>
  <p>Expected output:</p>
  <pre><code>rs12124819  1   0   752566  G   A
  rs28765502  1   0   776546  A   G
  rs7419119   1   0   832918  T   C
  rs950122    1   0   842013  T   G
  </code></pre>
  <p>I tried to create 2 array but couldn't find the correct way to use it:</p>
  <pre><code>awk 'FNR==NR{a[$4],b[$1];next} ($4) in a{$1=b[FNR]}1' file1 file2  &gt; out.txt 
  </code></pre>
  <p>Thanks a lot!</p>