title: Comparing two files in BASH line by line
body: <p>I need to make a script file that reads two files and prints out common lines between them. I know that both the files are the same number of lines and each line only contains one word. </p>
  
  <p>File 1:</p>
  
  <pre><code>Blue
  Red
  Orange
  Green
  Yellow
  Blue
  </code></pre>
  
  <p>File 2:</p>
  
  <pre><code>Blue
  Green
  Red
  Purple
  Yellow
  Blue
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>Blue
  Yellow
  Blue
  </code></pre>
  
  <p>So in the example Red and Green appear in both files, however they are not on the same line in each file so they are ignored.</p>
  
  <p>Have tried using awk, grep and comm but couldn't get them to work.</p>
  
  <p>Trying to find the solution that takes the shortest amount of time to process.</p>