[PowerShell] Function To Convert Tab (with Spaces) Delimited Txt File to CSV

Paste the function into PowerShell:

Function convertToCsv{
  param($filename)
  $new = Get-Content $filename | % {$_ -replace ("`t", ",") -replace(" ", "")}
  $new | Set-Content ($filename + ".csv")
}

Run as:

PS> convertToCsv FILENAME



Comments