title: Update Field in CSV with PowerShell
body: <p>I have a large data set in a CSV file of which I'm attemting to update the records without success.</p>
  
  <p>Here is what I have:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$MailData = Import-Csv $MailDB -Delimiter '|'
  
  $update = $MailData | ForEach-Object {
    if ($_.subject -like 'GGN*') {
      $_.status = 1
      $_.status_modified = (Get-Date).ToString('yyyy-MM-dd HH-mm-ss')
    }
  }
  
  $update | Export-Csv $MailDB -Delimiter '|' -NoTypeInformation
  </code></pre>
  
  <p>I've also tried the <code>-Append</code> switch and tried to do it with <code>Set-Content</code>. In all cases the content of <code>$MailData</code> is changed, but when I re-import the CSV file the data is not updated.</p>