I am trying to use Powershell to replace a semicolon ; with a pipe | that is in a file that is semicolon separated, so it's a specific set of semicolons that occurs between double-quotes ". Here's a sample of the file with the specific portion in bold:
Camp;Brazil;AI;BCS GRU;;MIL-32011257;172-43333640;;"1975995;1972871;1975";FAC0088/21;3;20.000;24.8;25.000;.149;GLASSES SPARE PARTS,;EXW;C;.00;EUR;
I've tried using -replace, as follows:
(Get-Content $file.PSPath) |
Foreach-Object { $_ -replace '".*(;).*"',"|" } |
However, the regex does not replace the semicolon between the quotes with a pipe. I've tried several other Regex to no avail. What would I do to accomplish this?