The script apparently cannot detect the content of a field if the content is enclosed in double quotes and starts with a comma. An example pattern follows.
I can reproduce this, thanks for reporting.
That is (from the code) expected behaviour and the only workaround currently is to avoid that combination.
Or escape the comma after the quote: "\, and strip that afterwars using sed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think, currently this cannot be fixed because of the way split() works.
Look at how the separation of a field is exactly the same syntax as the combination $quote$delim: its both ", in this case.
field1,", substring in field2",field3
^^ ^^
This would need a major code overhaul, maybe by using Text::CSV. So probably cleaning the source data may be easier in your case.
Last edit: Benedikt Hallinger 2023-12-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can reproduce this, thanks for reporting.
That is (from the code) expected behaviour and the only workaround currently is to avoid that combination.
Or escape the comma after the quote:
"\,and strip that afterwars usingsed.I think, currently this cannot be fixed because of the way
split()works.Look at how the separation of a field is exactly the same syntax as the combination
$quote$delim: its both",in this case.This would need a major code overhaul, maybe by using Text::CSV. So probably cleaning the source data may be easier in your case.
Last edit: Benedikt Hallinger 2023-12-28