how can I replace comma within quotas?
How about this?
cls
$csv = import-csv C:\temp\test1.csv
"Here is the csv"
$csv
foreach ($row in $csv) {
foreach ($col in $row.psobject.properties) { # look at each column
$col.value = $col.value.Replace(',','')
}
}
""
"Save the csv"
$csv | export-csv c:\temp\result.csv -NoTypeInformation
"Here is the plain old text content of the result file"
Get-Content c:\temp\result.csv
Produces these results.
Here is the csv
name answer1 answer2 answer3
---- ------- ------- -------
demo1 yes no I don't,,,,,,,, know
Save the csv
Here is the plain old text content of the result file
"name","answer1","answer2","answer3"
"demo1","yes","no","I don't know"
PS C:\>