I've got a CSV file that I need to split, to extract the ith column value of each record.
Here is a sample file.csv.
Column1,Column2,Column3
"value1_1_a, value1_1_b",value1_2,value1_3
"value2_1_a, value2_1_b, value2_1_c",value2_2,value2_3
In general, if I'd like to extract (for instance) Column2 values, I'd opt for a command like:
cat file.csv | awk -F, '{print $2}'
to get a result like:
Column2
value1_2
value2_2
Nevertheless, since Column1 values include strings with a variable number of , separator, I get wrong data. Hence, how can I use awk to accomplish my purpose?