title: Combing CSV files powershell
body: <p>So here is the backstory, I am attempting to validate data in several different ways. I've queried a database and exported that data to a csv.</p>
  
  <p>Then using powershell I run the following commands</p>
  
  <pre><code>$staleDates = Import-Csv DataAudit.csv | Where-Object { $_.asOfDate -ne "" } | Foreach-Object { $_.AsOfDate = $_.AsOfDate -as [datetime]; $_ } | Where-Object {$_.asOfDate -lt $measuredDate}
  
  $nullDates = Import-Csv DataAudit.csv | Where-Object {$_.asOfDate -eq ""}
  
  $percentTooLarge = Import-Csv DataAudit.csv | Foreach-Object { $_.SumHoldingPercent = $_.SumHoldingPercent -as [float]; $_ } | Where-Object { $_.SumHoldingPercent -gt 100 }
  
  $percentTooSmall = Import-Csv DataAudit.csv | Where-Object {$_.SumHoldingPercent -ne "" } | Foreach-Object { $_.SumHoldingPercent = $_.SumHoldingPercent -as [float]; $_ } | Where-Object {$_.SumHoldingPercent -lt 99.99999 }
  </code></pre>
  
  <p>Is there a way that I can combine the results from these 4 variables into a single csv that I can then email out as a report of the bad data?</p>
  
  <p>also, I am using Powershell v1.0</p>