title: How to compare and print result using awk NR==FNR
body: <p>I have 2 files. age2.txt &amp; age3.txt<br>
  <strong>age2.txt</strong>  </p>
  
  <pre><code>a=30  
  b=23  
  c=33  
  d=43  
  e=75  
  </code></pre>
  
  <p><strong>age3.txt</strong>  </p>
  
  <pre><code>a=30  
  b=26  
  c=33  
  d=44  
  e=75  
  </code></pre>
  
  <p>I need a command that :<br>
  compares the second column of both files and<br>
  print the line of first file (age2.txt) with " passed" if found matching or<br>
  print the line of first file (age2.txt) with " failed" if not matching  </p>
  
  <p>Expected output  </p>
  
  <pre><code>a=30 passed  
  b=23 failed  
  c=33 passed  
  d=43 failed  
  e=75 passed  
  </code></pre>
  
  <p>When I try it with awk, I see that for me the "failed" line repeats for both condition (notice for b=23 and d=43, it repeats..) </p>
  
  <pre><code>awk -F= 'NR==FNR{a[NR]=$2;next}a[FNR]!=$2 {print $line " Failed" ;} a[FNR]=$2 {print $line " Passed" ;}' age2.txt age3.txt  
  a=30 Passed  
  b=26 Failed  
  b=26 Passed  
  c=33 Passed  
  d=44 Failed  
  d=44 Passed  
  e=75 Passed  
  </code></pre>
  
  <p>Can somebody please help to avoid repetition of the "failed" line?<br>
  Thank You in advance :)  </p>