title: Comparing five columns of two different files and printing the differences of only two columns using awk
body: <p>so I have the first file as shown below:</p>
  <p>first.txt:</p>
  <pre><code>id|name|place|cost|member|
  1|max|USA|55|yes|
  2|Jhon|France|99|No|
  3|Mary|Canada|777|yes|
  4|Berry|USA|888|yes|
  5|Stella|Mexico|100|yes|
  </code></pre>
  <p>and the file second.txt:</p>
  <pre><code>id|name|place|cost|member|
  1|max|USA|55|No|
  2|Jhon|France|99|No|
  3|Mary|Canada|770|yes|
  4|Berry|USA|888|yes|
  5|Stella|Mexico|101|No|
  </code></pre>
  <p>So here I want to compare these two files according to the three first columns that should be the same and print the differences if they exist in the 4th and 5th column</p>
  <p>In this example, The output I want is:</p>
  <p>For the id: 1 and name: max and country: USA the Member is changed from Yes to No</p>
  <p>For the id: 3 and name: Mary and country: Canada the cost is changed from 777 to 770</p>
  <p>For the id: 5 and name: Stella and country: Mexico the cost is change from 100 to 101 and the Member is changed from Yes to No</p>
  <p>Knowing that my files may contain thousands of lines and don't have the same size.</p>
  <p>I tried the awk command but couldn't combine difference and then similarity and also the output is missing lines, and also the print didn't know where to put:</p>
  <pre><code>awk -F'|' 'NR++FNR{C[$1,$2,$3]++;C[$4,$5]++; next} C[$1,$2,$3] &gt; 0 &amp;&amp; C[$4,$5] == 0'
  </code></pre>