title: Splitting huge CSV file
body: <p>I have a huge csv file which is about 20 GB. It has 5,000 columns and 2,500,000 rows. I want to write each column of that into one file. I already tried FOR loop, but it is pretty slow. My code is below:</p>
  
  <pre><code>Columns=$(head -n 1 train.csv | sed "s/,/\n/g" | wc -l)
  mkdir cols
  for i in `seq 1 $Columns`;
  do
      echo $i
      tail -n +2 train.csv | cut -d',' -f$i &gt; cols/col_$i.txt
  done 
  </code></pre>
  
  <p>I appropriate any suggestion to accelerate this.</p>