CSV files format Data like the following
"Pizza,wings,icecream","hopper","0",,"Masdfasdf","USA","381","10 AM","cap",,,"monster"
Using a comma as the delimiter such as below will result in fields with commas to be counted as delimiters, which is not what i want.
cat /path/to/file | cut -d , -f2
will return
wings
when i want
hopper
I think i have found a solution logically, but i am unsure how to implement it.
How would i make a delimiter that would say "If i am a comma, surrounded by either another comma or quotes, count me as a delimiter"?
Example
[tksmith@rifle ~]$ cat deleteme
"Pizza,wings,icecream","hopper","0",,"Masdfasdf","USA","381","10 AM","cap",,,"monster"
[tksmith@rifle ~]$ cat deleteme | cut -d , -f2
wings
Text::CSV
orcsvtool
that can do this out-of-the-box e.g.csvtool col 2 file.csv
csvkit
e.g.csvcut -c2