Possible Duplicate:
Is there a robust command line tool for processing csv files?
I can use cut
to extract columns from a file:
$ cat foo
foo,bar,hello
bash,baz,world
$ cut -d\, -f2 foo
bar
baz
But what if a column has a delimiter in it that is safe inside an enclosure like this?
$ cat foo
foo,"hello, world",bar
bash,goodbye,baz
$ cut -d\, -f2 temp12
"hello
goodbye
Is there some way to tell cut
to respect the enclosure of quote ""
characters?