I would like to find a way to use an iterative loop (for or while) to remove quotes (") from a dataset like the following:
"Macao,""China,Macao Special Administrative Region"",MAC
I know that there is the following way to remove them, which is actually more efficient, but it is important that it is an iterative statement in bash
sed -i -e 's/"//g' file.csv
Any idea?
CodePudding user response:
You can use while read -r
to read the lines. Use Parameter Expansion to remove the double quotes.
while read -r line ; do printf '%s\n' "${line//\"}" ; done < input