I am in the situation where I need to replace the comma with pipe using PowerShell. the fields are within double quotes so I need to remove them as well. but Some fields have comma in the data so When I replace, I should keep fields commas with while space.
Data look like this:
"Whaling, Mark","faflitto@cgf.com"
I want data to be like this:
Whaling Mark |faflitto@cgf.com
How to achieve this using PowerShell?. Help appreciated.
My script is this for now:
(Get-Content -ReadCount 0 Compliance2022.txt) -replace ',','|' -replace '"',' ' | Set-Content COMPLIANCE2022_.txt