I am trying to parse a csv file line by line and its format looks something like this:
"name","content1,with commas as you see", "content2, also may contain commas", "..." ... ...
I want to get content in a specific column without quotes. for example: 1st column and 3rd. Thus, the expected content should be:
name (if get column 1) content2, also may contain commas (if get column 3)
I tried to use awk, but that didn't work. I also tried:
while IFS=, read col1 col2 col3 col4; do echo "got ${col1}|${col3}"; done < file
But it contains quotation marks "", and the contents of col3 are erroneous, which mixes a comma inside each column. How do I split such formats containing commas in each column?
source share