I have a file in which the fields are separated by comma.
Some example input:
col1,"1,2",col3
col1,"1,2,3",col3
col1,"1 2,3",col3
col1,"1 "2,3"",col3
Now, I have to fetch the second column, so that I get:
"1,2"
"1,2,3"
"1 2,3"
"1 "2,3""
cut -d, -f2 file
doesn't do what I want.
So, how can I retrieve column 2 from the above input?