miller icon indicating copy to clipboard operation
miller copied to clipboard

Notwithstanding --skip-comments, double-quoted tokens in comment are mishandled with any --c2* option

Open sphakka opened this issue 1 year ago • 3 comments

I'm possibly missing something, but can't get mlr (v6.12.0-dev) to work with comments containing double quotes:

$ echo -e '# Foo "bar" quux'  | mlr --skip-comments  --c2m cat
mlr: parse error on line 1, column 7: bare " in non-quoted-field.

Shouldn't it ignore the comment line altogether?

sphakka avatar May 12 '24 15:05 sphakka

Hi @sphakka I have your same results.

A way to have an output is to change the input format in csvlite, but it may not be suitable for your CSV input.

echo -e '# Foo "bar" quux\na,b\n1,2' | mlr --skip-comments --icsvlite --omarkdown cat
a b
1 2

aborruso avatar May 12 '24 15:05 aborruso

Thanks for the workaround, @aborruso!

sphakka avatar May 12 '24 15:05 sphakka

Shouldn't it ignore the comment line altogether?

@sphakka this is related to #1346

In Miller <= 5 (written in C) I had my own CSV parser and I could make it do the right thing.

In Miller 6 (re-written in Go) I use the Go library's CSV parser. Unfortunately, it parses CSV liines as CSV and then lets me decide whether or not they look like comments. This isn't great.

I either need to port my own CSV parser from C to Go and stop using the Go library's CSV parser, or, maybe find some way to intervene in what it's doing ....

johnkerl avatar May 13 '24 14:05 johnkerl

Closing this as a duplicate of #1346 (which needs doing) ...

johnkerl avatar Jun 08 '24 17:06 johnkerl