title: compare two files and get the output for the same lines
body: <p>How can I get the following output using linux command by comparing two text files? Thanks.</p>
  
  <p>file1:</p>
  
  <pre><code>site110
  site120
  </code></pre>
  
  <p>file2(Updated):</p>
  
  <pre><code>domain1.com - site110
  domain2.com - site111
  domain3.com - site112
  domain4.com - site113
  domain5.com - site120
  domain6.com - site1201
  domain7.com - site1202
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>domain1.com - site110
  domain5.com - site120
  </code></pre>
  
  <p>If I use:</p>
  
  <pre><code>grep -f file1 file2
  </code></pre>
  
  <p>the output will be:</p>
  
  <pre><code>domain1.com - site110
  domain5.com - site120
  domain6.com - site1201
  domain7.com - site1202
  </code></pre>
  
  <p>which the last two lines are not what I want. Thanks.</p>