title: Combine two or more rows in a csv using powershell
body: <p>I receive a file from one of our clients that looks like this: (I added headers to this to it for easier processing). Sample Input:</p>
  
  <pre><code>PlanID,Date,Transaction,Type,Ticker,Amount,Cash
  01,121211,div,mf,fjk,25,cash
  01,121211,div,mf,fjk,30,cash
  01.121211,buy,mf,fjk,55,cash
  02,121211,div,sd,ejd,10,cash
  02,121211,div,sd,ejd,15,cash
  02,121211,buy,sd,ejd,25,cash
  </code></pre>
  
  <p>I need a way to combine all the rows with Transaction= 'div' by summing up their amount for each PlanID. This is how I desire my output to look like:</p>
  
  <p>Sample Output:</p>
  
  <pre><code>PlanID,Date,Transaction,Type,Ticker,Amount,Cash
  01,121211,div,mf,fjk,55,cash
  01.121211,buy,mf,fjk,55,cash
  02,121211,div,sd,ejd,25,cash
  02,121211,buy,sd,ejd,25,cash
  </code></pre>
  
  <p>So, there is only one div row before buy row (with amount summed up, will always be the buy amount). Any ideas how to approach this would be greatly appreciated?</p>
  
  <p>Thanks much in advance!!</p>