I have a shell script to take data from a table and put it in a .csv file. The data I get is tab delimited and I used sed 's/\t/,/g'
. This works but the data I have has occasional commas in the value as well, say "abc,def".
Now when I open the .csv file this value is split and moved to next column considering the comma, now "abc" is in one column and "def" in another.
How can I handle this and have values with commas displayed as is? Or can I convert a comma to a pipe symbol (|
) and make the .csv identify the pipe symbol as delimiter?