title: compare two files with different column and row numbers
body: <p>I want to compare two big files with different column and row numbers and print those line which have a common word (like <code>KJ</code>):</p>
  
  <p>file1:</p>
  
  <pre><code>XT1 123 aa NR
  XT2 444 bb GF 
  XT3 666 aa KJ
  </code></pre>
  
  <p>file2</p>
  
  <pre><code>fc KK pcn
  wd CC KJ
  </code></pre>
  
  <p>output</p>
  
  <pre><code>XT3 666 aa wd CC KJ
  </code></pre>
  
  <p>I tried but I didn't get anything:</p>
  
  <pre><code>awk 'FNR==NR{a[$4]=$3;next}{if (a[$3])print a[$3],$0}' file1 file2
  </code></pre>
  
  <p>Thank you in advance for your help</p>