mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-20 18:10:07 +00:00
bugfix cat -n: it was numbering 0-up not 1-up
This commit is contained in:
parent
659ca56f20
commit
dccb66e1d2
2 changed files with 21 additions and 21 deletions
|
|
@ -97,7 +97,7 @@ static sllv_t* mapper_cat_process(lrec_t* pinrec, context_t* pctx, void* pvstate
|
|||
static sllv_t* mapper_catn_process(lrec_t* pinrec, context_t* pctx, void* pvstate) {
|
||||
mapper_cat_state_t* pstate = (mapper_cat_state_t*)pvstate;
|
||||
if (pinrec != NULL) {
|
||||
char* counter_field_value = mlr_alloc_string_from_ull(pstate->counter++);
|
||||
char* counter_field_value = mlr_alloc_string_from_ull(++pstate->counter);
|
||||
lrec_prepend(pinrec, pstate->counter_field_name, counter_field_value, FREE_ENTRY_VALUE);
|
||||
return sllv_single(pinrec);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,28 +17,28 @@ a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
|||
mlr cat /dev/null
|
||||
|
||||
mlr cat -n ./reg_test/input/abixy
|
||||
n=0,a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
n=1,a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
n=2,a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
n=3,a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
n=4,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
n=5,a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
n=6,a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
n=7,a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006
|
||||
n=8,a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
n=9,a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
n=1,a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
n=2,a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
n=3,a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
n=4,a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
n=5,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
n=6,a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
n=7,a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
n=8,a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006
|
||||
n=9,a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
n=10,a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
|
||||
mlr cat -N counter ./reg_test/input/abixy
|
||||
counter=0,a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
counter=1,a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
counter=2,a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
counter=3,a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
counter=4,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
counter=5,a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
counter=6,a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
counter=7,a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006
|
||||
counter=8,a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
counter=9,a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
counter=1,a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
counter=2,a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
counter=3,a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
counter=4,a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
counter=5,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
counter=6,a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
counter=7,a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
counter=8,a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006
|
||||
counter=9,a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
counter=10,a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
|
||||
mlr cut -f a,x ./reg_test/input/abixy
|
||||
a=pan,x=0.3467901443380824
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue