title: Awk - Extract and delimit and group by data in a specific column(s) from a comma delimited file
body: <p>I know that there are multiple posting on extracting but what I am doing is extracting specific columns from a CSV delimited files grouping by and summing two fields. I want to add an additional <code>DATE</code> column in the group but that column is <code>MM/DD/YYYY HH:MM:SS</code> and I need to extract just the date for the group by.</p>
  
  <p>Example Input:</p>
  
  <pre><code>Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10
  1/1/2016 9:05:01,O1234,APPLE,10,1.01,AAAA,BBBB,CCCC,DDDD,EEEE
  1/1/2016 10:05:01,O1234,APPLE,5,0.99,AAAA,BBBB,CCCC,DDDD,EEEE
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>awk -F',' -v OFS=',' '
     (NR!=1) {
         a[$2","$3","$9","$10]+=$4;
         b[$2","$3","$9","$10]+=$5;
         c[$2","$3","$9","$10]+=($4*$5)
     }
     END {
         for(i in a){print i,a[i],b[i],c[i]}
     }
  ' data.txt &gt;aa.txt
  </code></pre>
  
  <p>I need to edit this statement so that I can group on the date only 1/1/2016 for $1 vs the entire string.</p>
  
  <pre><code>awk -F',' -v OFS=',' '
      (NR!=1) {
          a[$1","$2","$3","$9","$10]+=$4;
          b[$1","$2","$3","$9","$10]+=$5;
          c[$1","$2","$3","$9","$10]+=($4*$5)
      }
      END {
          for(i in a){print i,a[i],b[i],c[i]}
      }
  ' data.txt &gt;aa.txt
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>1/1/2016,O1234,AAPL,DDDD,EEEE,15,2.00,15.05
  </code></pre>