LucD
Leadership
Leadership

Provided these characters are actually spaces, you can do something like this.

It removes starting and trailing spaces from the first row column headers.

$fileName = 'C:\vmnames.csv'

$content = Get-Content -Path $fileName

$content[0] = ($content[0].Split(',') | %{$_.TrimStart(' ').TrimEnd(' ')}) -join ','

$content | Out-File -FilePath $fileName


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos