title: How to merge multiple CSV files into one, with only unique values
body: <p>I have multiple CSV files in a directory, all with the same data model, some of which are duplicate entires.  </p>
  
  <p>file1.csv: </p>
  
  <pre><code>1       joe      red
  2       bill     blue 
  3       bob      green
  </code></pre>
  
  <p>file2.csv: </p>
  
  <pre><code>3       bob      green
  4       mary     white 
  5       jim      yellow
  </code></pre>
  
  <p>file3.csv: </p>
  
  <pre><code>5       jim      yellow
  6       lauren    pink  
  7       george    purple
  </code></pre>
  
  <p>My goal is to produce a single CSV file of all the unique values.  </p>
  
  <p>So far the code I have is this: </p>
  
  <ol>
  <li><p>Concatenated all the files in iTerm2 using</p>
  
  <pre><code> cat *.csv &gt; combined.csv
  </code></pre></li>
  <li><p>And this script: </p>
  
  <pre><code>require 'csv'
  
  File.open("all_unique_rows.csv", "w+") { 
  
    |file| file.puts File.readlines("combined.csv").uniq 
  
  }
  </code></pre></li>
  </ol>
  
  <p>However, I want to be able to do this all from a single Ruby script, however I'm just not sure how to make the "combined.csv" file one giant file using Ruby.  </p>