title: Use sed to format huge files
body: <p>I have a test file that is 4.5GB and I am trying to format it.</p>
  
  <p>First I am trying to replace the tabs with ',' and also separate each column field with a <code>"</code>.</p>
  
  <p>Second I am formatting a date field in the file with awk and sed.</p>
  
  <p>Here is what I am using:</p>
  
  <p>For formatting:</p>
  
  <pre><code>cat test_sample.csv | sed -e 's/"/""/g' | sed -e 's/\t/","/g' | sed -e 's/$/"/g' | sed -e 's/^/"/' &gt; test_sample.csv
  </code></pre>
  
  <p>For Date:</p>
  
  <pre><code>awk 'BEGIN{FS=OFS="\",\""} NR&gt;1{cmd = "date -d \"" $10 "\" \"+%Y-%m-%d\"";cmd | getline out; $10=out; close("uuidgen")} 1' test_sample.csv &gt; _report.tmp &amp;&amp; mv _report.tmp test_sample.csv
  </code></pre>
  
  <p>These commands are runnig fine for small files but are failing and is clearing all the data in the file.</p>
  
  <p>Please can someone help me format this file?</p>