How can I delete a column from a CSV file which has comma separated value with a string enclosed in double quotes and a comma in between? I have a file 44.csv with 4 lines including the header like the below format:
column1, column2, column3, column 4, column5, column6
12,455,"string with quotes, and with a comma in between",4432,6787,890,88
4432,6787,"another, string with quotes, and with two comma in between",890,88,12,455
11,22,"simple string",77,777,333,22
I need to cut the 1,2,3 columns from the file, so I used the cut command as below
cut -d"," -f1,2,3 44.csv > 444.csv
I am getting the output as
column1, column2, column3
12,455,"string with quotes
4432,6787,"another string with quotes
11,22,"simple string"
But I need the output to be
column1, column2, column3
12,455,"string with quotes, and with a comma in between"
4432,6787,"another, string with quotes, and with two comma in between"
11,22,"simple string"
Any help is greatly appreciated.
Thanks