title: Comparing two files at end of line in Linux
body: <p>I would like to compare two files and get the output of matching string in one of the files at the end of the line:</p>
  
  <p>Let's say I have two files:-</p>
  
  <p>file1:</p>
  
  <pre><code>xyzabcdef
  xyz
  abcdefghi
  </code></pre>
  
  <p>file2:</p>
  
  <pre><code>fghjkl
  wertyu
  abcdef
  </code></pre>
  
  <p>I could do something like this:</p>
  
  <pre><code>grep -Fif file2 file1
  </code></pre>
  
  <p>This gives me the following output:</p>
  
  <pre><code>xyzabcdef
  abcdefghi
  </code></pre>
  
  <p>This is because abcdef in file2 matches both of those lines in file1. However, what I would like is to just compare the end of the line in file1 to those in file2. So, I would like output to be:</p>
  
  <pre><code>xyzabcdef
  </code></pre>
  
  <p>Is there some magic command that will let me do this?</p>