title: bash- get all lines with the same column value in two files
body: <p>I have two text files each with 3 fields. I need to get the lines with the same value on the third field. The 3rd field value is unique in each file. Example:</p>
  
  <p>file1:</p>
  
  <blockquote>
    <p>1 John 300<br>
    2 Eli  200<br>
    3 Chris 100<br>
    4 Ann 600</p>
  </blockquote>
  
  <p>file2:</p>
  
  <blockquote>
    <p>6 Kevin 250<br>
    7 Nancy 300<br>
    8 John  100   </p>
  </blockquote>
  
  <p>output: </p>
  
  <blockquote>
    <p>1 John 300<br>
    7 Nancy 300<br>
    3 Chris 100<br>
    8 John  100   </p>
  </blockquote>
  
  <p>When I use the following command:</p>
  
  <pre><code>cat file1 file2 | sort -k 3 | uniq -c -f 2 
  </code></pre>
  
  <p>I get only one row from an input file with the duplicate value. I need both!</p>