I have a csv file where some cells contain ,
between "..."
. I need to change only the commas between the quotation marks to semicolons without the rest of the commas on the line getting replaced. That is, I have something like this:
x,"y,z",a
And only the comma between y
and z
should be replaced with ;
. How should this be done in vim?
For a single pair of quotes per line you could use:
Input:
output:
For more than a pair of quotes per line you could use the following awk command:
This command is based on a question in Unix StackExchange. It will set a quote
"
as the field separator and substitute commas in every other field usinggsub
.