Googling around, I saw this in a forumpost somewhere, but to prevent me from losing it, I've put the script below:
$CSV = import-csv 'C:\scripts\trailingspaces.csv'
$CSV | Foreach-Object {
$_.PSObject.Properties | Foreach-Object { $_.Value = $_.Value.Trim() }
}
$CSV | ConvertTo-Csv -UseCulture -NoTypeInformation | Out-File 'C:\scripts\trimmed.csv'
Yeay, no more going mad!
Thanks m8
ReplyDelete