diff --git a/c/mapping/mapper_put_or_filter.c b/c/mapping/mapper_put_or_filter.c index 100608f54..2122e21bb 100644 --- a/c/mapping/mapper_put_or_filter.c +++ b/c/mapping/mapper_put_or_filter.c @@ -221,6 +221,7 @@ static void shared_usage(FILE* o, char* argv0, char* verb) { fprintf(o, " %s %s put 'begin {@foo = 97} $column += @foo'.\n", argv0, verb); fprintf(o, " The value part is subject to type-inferencing as specified by -S/-F.\n"); fprintf(o, " May be specified more than once, e.g. -s name1=value1 -s name2=value2.\n"); + fprintf(o, " Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE\n"); fprintf(o, "\n"); fprintf(o, "Tracing options:\n"); diff --git a/doc/content-for-reference-verbs.html b/doc/content-for-reference-verbs.html index f1d875a86..574990324 100644 --- a/doc/content-for-reference-verbs.html +++ b/doc/content-for-reference-verbs.html @@ -194,6 +194,20 @@ POKI_RUN_COMMAND{{mlr --icsv --ojson clean-whitespace data/clean-whitespace.csv}
  • clean_whitespace + + +

    count

    + +
    + +POKI_RUN_COMMAND{{mlr count --help}}HERE + +POKI_RUN_COMMAND{{mlr count data/medium}}HERE + +POKI_RUN_COMMAND{{mlr count -g a data/medium}}HERE + +POKI_RUN_COMMAND{{mlr count -g a,b data/medium}}HERE +

    count-distinct

    diff --git a/doc/cookbook.html b/doc/cookbook.html index 150202aa3..2a4d1938c 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -858,7 +858,7 @@ date,qoh
     $ wc -l data/miss-date.csv
    -1372 data/miss-date.csv
    +    1372 data/miss-date.csv
     

    diff --git a/doc/data-examples.html b/doc/data-examples.html index c8bcf0b6d..6f4c434e3 100644 --- a/doc/data-examples.html +++ b/doc/data-examples.html @@ -208,7 +208,7 @@ St. Johns - - -

     $ wc -l data/colored-shapes.dkvp
    -10078 data/colored-shapes.dkvp
    +   10078 data/colored-shapes.dkvp
     

    diff --git a/doc/data-sharing.html b/doc/data-sharing.html index f6b274e37..6c8f3801f 100644 --- a/doc/data-sharing.html +++ b/doc/data-sharing.html @@ -417,11 +417,11 @@ wye pan 5 0.5732889198020006 0.8636244699032729 {5}

     $ mlr --opprint put '$o = system("echo -n ".$a."| sha1sum")' data/small
     a   b   i x                   y                   o
    -pan pan 1 0.3467901443380824  0.7268028627434533  bd2bd8216b9cb4aa5a12daa6cfc98eef2ee20e56  -
    -eks pan 2 0.7586799647899636  0.5221511083334797  16191338e81a46c7d127f5c8899f5c92e3cd38e3  -
    -wye wye 3 0.20460330576630303 0.33831852551664776 14ba3c3e96a2474ab6dc7409ebf9d6b9cc3d84f0  -
    -eks wye 4 0.38139939387114097 0.13418874328430463 16191338e81a46c7d127f5c8899f5c92e3cd38e3  -
    -wye pan 5 0.5732889198020006  0.8636244699032729  14ba3c3e96a2474ab6dc7409ebf9d6b9cc3d84f0  -
    +pan pan 1 0.3467901443380824  0.7268028627434533  f29c748220331c273ef16d5115f6ecd799947f13  -
    +eks pan 2 0.7586799647899636  0.5221511083334797  456d988ecb3bf1b75f057fc6e9fe70db464e9388  -
    +wye wye 3 0.20460330576630303 0.33831852551664776 eab0de043d67f441c7fd1e335f0ca38708e6ebf7  -
    +eks wye 4 0.38139939387114097 0.13418874328430463 456d988ecb3bf1b75f057fc6e9fe70db464e9388  -
    +wye pan 5 0.5732889198020006  0.8636244699032729  eab0de043d67f441c7fd1e335f0ca38708e6ebf7  -
     

    diff --git a/doc/manpage.html b/doc/manpage.html index 39bfa47ad..c2cd16faa 100644 --- a/doc/manpage.html +++ b/doc/manpage.html @@ -636,6 +636,7 @@ VERBS mlr filter put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives @@ -1009,6 +1010,7 @@ VERBS mlr put put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives diff --git a/doc/manpage.txt b/doc/manpage.txt index b17420cf3..924401de6 100644 --- a/doc/manpage.txt +++ b/doc/manpage.txt @@ -562,6 +562,7 @@ VERBS mlr filter put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives @@ -935,6 +936,7 @@ VERBS mlr put put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives diff --git a/doc/mlr.1 b/doc/mlr.1 index 8e009a7ef..249ca5836 100644 --- a/doc/mlr.1 +++ b/doc/mlr.1 @@ -757,6 +757,7 @@ semicolons to separate expressions.) mlr filter put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives @@ -1226,6 +1227,7 @@ semicolons to separate expressions.) mlr put put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives diff --git a/doc/reference-dsl.html b/doc/reference-dsl.html index 2103a2bd3..fa46e1a6e 100644 --- a/doc/reference-dsl.html +++ b/doc/reference-dsl.html @@ -2025,7 +2025,7 @@ subsequent assignments are done unconditionally:

     $ mlr put '$x > 0.0; $y = log10($x); $z = sqrt($y)' data/put-gating-example-1.dkvp
     x=-1,y=nan,z=nan
    -x=0,y=-inf,z=-nan
    +x=0,y=-inf,z=nan
     x=1,y=0.000000,z=0.000000
     x=2,y=0.301030,z=0.548662
     x=3,y=0.477121,z=0.690740
    diff --git a/doc/reference-verbs.html b/doc/reference-verbs.html
    index cfb199627..059f9309a 100644
    --- a/doc/reference-verbs.html
    +++ b/doc/reference-verbs.html
    @@ -70,6 +70,7 @@ pageTracker._trackPageview();
     • cat
    • check
    • clean-whitespace
    +• count
    • count-distinct
    • count-similar
    • cut
    @@ -586,6 +587,82 @@ $ mlr --icsv --ojson clean-whitespace data/clean-whitespace.csv
  • clean_whitespace + + +

    count

    + +
    + +

    +

    +
    +$ mlr count --help
    +Usage: mlr count [options]
    +Prints number of records, optionally grouped by distinct values for specified field names.
    +
    +Options:
    +-g {a,b,c}    Field names for distinct count.
    +-n            Show only the number of distinct values. Not compatible with -u.
    +-o {name}     Field name for output count. Default "count".
    +
    +
    +

    + +

    +

    +
    +$ mlr count data/medium
    +count=10000
    +
    +
    +

    + +

    +

    +
    +$ mlr count -g a data/medium
    +a=pan,count=2081
    +a=eks,count=1965
    +a=wye,count=1966
    +a=zee,count=2047
    +a=hat,count=1941
    +
    +
    +

    + +

    +

    +
    +$ mlr count -g a,b data/medium
    +a=pan,b=pan,count=427
    +a=eks,b=pan,count=371
    +a=wye,b=wye,count=377
    +a=eks,b=wye,count=407
    +a=wye,b=pan,count=392
    +a=zee,b=pan,count=389
    +a=eks,b=zee,count=357
    +a=zee,b=wye,count=455
    +a=hat,b=wye,count=423
    +a=pan,b=wye,count=395
    +a=zee,b=eks,count=391
    +a=hat,b=zee,count=385
    +a=hat,b=eks,count=389
    +a=wye,b=hat,count=426
    +a=pan,b=eks,count=429
    +a=eks,b=eks,count=413
    +a=hat,b=hat,count=381
    +a=hat,b=pan,count=363
    +a=zee,b=zee,count=403
    +a=pan,b=hat,count=417
    +a=pan,b=zee,count=413
    +a=zee,b=hat,count=409
    +a=wye,b=zee,count=385
    +a=eks,b=hat,count=417
    +a=wye,b=eks,count=386
    +
    +
    +

    +

    count-distinct

    @@ -1020,6 +1097,7 @@ semicolons to separate expressions.) mlr filter put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives @@ -2403,6 +2481,7 @@ semicolons to separate expressions.) mlr put put 'begin {@foo = 97} $column += @foo'. The value part is subject to type-inferencing as specified by -S/-F. May be specified more than once, e.g. -s name1=value1 -s name2=value2. + Note: the value may be an environment variable, e.g. -s sequence=$SEQUENCE Tracing options: -v: Prints the expressions's AST (abstract syntax tree), which gives @@ -3968,7 +4047,7 @@ Options:
     $ wc -l data/colored-shapes.dkvp
    -10078 data/colored-shapes.dkvp
    +   10078 data/colored-shapes.dkvp
     

    @@ -4140,7 +4219,7 @@ color=purple,shape=square,flag=0

     $ wc -l data/repeats.dkvp
    -57 data/repeats.dkvp
    +      57 data/repeats.dkvp