title: Ruby, How to match strings from one file with another file and print the matched strings
body: <p>I have two files. File1:</p>
  
  <pre class="lang-none prettyprint-override"><code>ruby,amazing,awesome
  </code></pre>
  
  <p>file2:</p>
  
  <pre class="lang-none prettyprint-override"><code>ruby-443-543-fx\n
  amazing-122-454-nx\n
  hello-432-544-lx\n
  awesome-522-65-nx\n
  </code></pre>
  
  <p>How to do I run a search to match file1 word with file2 line (for example, amazing from file1 to be matched with amazing-122-454-nx)? Then, I need to print the matched results as followings:</p>
  
  <pre class="lang-none prettyprint-override"><code>ruby-443-543-fx\n
  amazing-122-454-nx\n
  awesome-522-65-nx\n
  </code></pre>