title: Conversion from CSV to TSV with content changes
body: <p>I need to change CSV File to TSV, and also remove line breaks and double quotes.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>$filePath = "C:\Users\at1704171\Documents\Infinity Scorecard PBIX\converter"
  $mkdir = New-Item -ItemType Directory -Force -Path (Join-Path -Path $filePath -ChildPath 'converted')
  $files = Get-ChildItem (Join-Path -Path $filePath -ChildPath "*") -Include *.csv
  $sep = "`t"
  $ext = '.tsv'
  
  foreach($file in $files)
  {
      $filename = -Join($mkdir,"\",(Get-Item $file).BaseName,$ext)
          Import-Csv $file |
          ConvertTo-Csv -NoTypeInformation -Delimiter $sep |
          % { $_.Replace("`r"," ").Replace("`n"," ").Replace('"',"") } |
          Out-File -FilePath $filename -Encoding utf8
  }
  </code></pre>
  
  <p>it's basically converting a CSV File to TSV, but also removing line breaks and double quotes. However I noticed that there are some "tabs" (`t) within the string so I needed to insert another line between "Import" and "Convert" to replace those "tabs" by a space</p>
  
  <p>I do not understand how the syntax works so I literally copied the line below "Convert" since it executes the same function and did this, but it gives an error</p>
  
  <pre><code>$filePath = "C:\Users\at1704171\Documents\Infinity Scorecard PBIX\converter"
  $mkdir = New-Item -ItemType Directory -Force -Path (Join-Path -Path $filePath -ChildPath 'converted')
  $files = Get-ChildItem (Join-Path -Path $filePath -ChildPath "*") -Include *.csv
  $sep = "`t"
  $ext = '.tsv'
  
  foreach($file in $files)
  {
      $filename = -Join($mkdir,"\",(Get-Item $file).BaseName,$ext)
          Import-Csv $file |
          % { $_.Replace("`t"," ") } | --this is the line I added
          ConvertTo-Csv -NoTypeInformation -Delimiter $sep |
          % { $_.Replace("`r"," ").Replace("`n"," ").Replace('"',"") } |
          Out-File -FilePath $filename -Encoding utf8
  }
  </code></pre>
  
  <p>anybody's help is greatly appreciated here, thank you guys</p>