I am getting the "The term '-replace' is not recognized" issue while using the below code to exclude any extra quotes in the middle of the string field. Please correct me, If I am doing something wrong here? Or Any better code suggestions to remove the extra Quotes in the middle of the string field.
Error Details: Final Status: The term '-replace' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Here is some sample data:
LocationID,LocationNM,DescriptionTXT,ManagingOrganizationID "1",""PCP:Primary Care 1","Primary Care 1","355" "2","Orthopedic Surgery and Specialty Hospital","Orthopedic Surgery and Specialty Hospital","355" "5","Primary Care-0","Primary Care-0 C3,"VITAMIN D","355"
Any help is much appreciated. Thanks
$FilePath = c:\Test
Get-ChildItem $FilePath -Filter *.csv | ForEach-Object {
(Get-Content $_.FullName -Raw) | Foreach-Object {
$_ -replace '0"x', '0x' `
-replace '"PCP:', 'PCP:' `
-replace ',"VITAMIN b12', ',VITAMIN b12' `
-replace 'C3,"VITAMIN D,', 'C3,VITAMIN D,' `
-replace 'to "spice use', 'to spice use' `
-replace '30"x', '30x' `
-replace '" ', ' '
} | Set-Content $_.FullName
}