csvtk sep --no-header-row --num-cols N --drop does not work correctly when 1 row of column to be separated has (strictly) more fields than --num-cols
[x] provide a reproducible example
$ echo -e "gender,name\nmale,A;B;C;D\nfemale,a;b;c;d" |
csvtk pretty
gender name
------ -------
male A;B;C;D
female a;b;c;d
INCORRECT :
$ echo -e "gender,name\nmale,A;B;C;D\nfemale,a;b;c;d" |
csvtk del-header |
csvtk sep -f 2 -s ';' --num-cols 3 --no-header-row --drop |
csvtk pretty -H
male A;B;C;D A B C D
female a;b;c;d a b c d
<br>
Output is correct if 1st row has a number of fields to separate equal (or less) than `--num-cols` :
CORRECT :
$ echo -e "gender,name\nmale,A;B;C\nfemale,a;b;c;d" |
csvtk del-header |
csvtk sep -f 2 -s ';' --num-cols 3 --no-header-row --drop |
csvtk pretty -H
male A;B;C A B C
female a;b;c;d a b c
### Thank you
I'm grateful to users who have greatly helped to report bugs and suggested new features.
I may respond to issues or fix bugs quickly, but I usually implement new features periodically (two or more weeks).
Prerequisites
csvtk version
Describe your issue
csvtk sep --no-header-row --num-cols N --drop
does not work correctly when 1 row of column to be separated has (strictly) more fields than--num-cols
INCORRECT :
$ echo -e "gender,name\nmale,A;B;C;D\nfemale,a;b;c;d" | csvtk del-header | csvtk sep -f 2 -s ';' --num-cols 3 --no-header-row --drop | csvtk pretty -H male A;B;C;D A B C D female a;b;c;d a b c d
CORRECT :
$ echo -e "gender,name\nmale,A;B;C\nfemale,a;b;c;d" | csvtk del-header | csvtk sep -f 2 -s ';' --num-cols 3 --no-header-row --drop | csvtk pretty -H male A;B;C A B C female a;b;c;d a b c