title: Merging very large csv files with common column
body: <p>For example, I have two csv files, 
  0.csv</p>
  
  <pre><code>100a,a,b,c,c
  200a,b,c,c,c
  300a,c,d,c,c
  </code></pre>
  
  <p>and
  1.csv</p>
  
  <pre><code>100a,Emma,Thomas
  200a,Alex,Jason
  400a,Sanjay,Gupta
  500a,Nisha,Singh
  </code></pre>
  
  <p>and I want an output to be like </p>
  
  <pre><code>100a,a,b,c,c,Emma,Thomas
  200a,b,c,c,c,Alex,Jason
  300a,c,d,c,c,0,0
  400a,0,0,0,0,Sanjay,Gupta
  500a,0,0,0,0,Nisha,Singh
  </code></pre>
  
  <p>How do I do that in Unix shell script or Perl? I know the unix "join" command, and that would work well with the small files. For example to get my result I could just do</p>
  
  <pre><code>join -t , -a 1 -a 2 -1 1 -2 1 -o 0 1.2 1.3 1.4 1.5 2.2 2.3 -e "0" 0.csv 1.csv
  </code></pre>
  
  <p>but that is not feasible for my purposes, since my actual data file has more than a million columns (total data size in the gigabytes), and thus my unix command would also be more than a million characters long. This might be the most important headache, as inefficient code gets bogged down quite fast.</p>
  
  <p>Also note that I need the placeholder character "0" whenever there is missing data. This prevents me from simply using this </p>
  
  <pre><code>join -t , -a 1 -a 2 -1 1 -2 1 0.csv 1.csv
  </code></pre>
  
  <p>Also a beginner Perl programmer, so some details really welcome. I'd prefer the solution to be perl or shell script, but really anything that works would be fine. </p>