diff --git a/c/mapping/mapper_filter.c b/c/mapping/mapper_filter.c index c0e918145..a76382788 100644 --- a/c/mapping/mapper_filter.c +++ b/c/mapping/mapper_filter.c @@ -45,7 +45,8 @@ static void mapper_filter_usage(FILE* o, char* argv0, char* verb) { fprintf(o, "Please use a dollar sign for field names and double-quotes for string\n"); fprintf(o, "literals. If field names have special characters such as \".\" then you might\n"); fprintf(o, "use braces, e.g. '${field.name}'. Miller built-in variables are\n"); - fprintf(o, "NF NR FNR FILENUM FILENAME PI E.\n"); + fprintf(o, "NF NR FNR FILENUM FILENAME PI E, and ENV[\"namegoeshere\"] to access environment\n"); + fprintf(o, "variables; the environment-variable name may be an expression, e.g. a field value.\n"); fprintf(o, "\n"); fprintf(o, "Examples:\n"); fprintf(o, " %s %s 'log10($count) > 4.0'\n", argv0, verb); diff --git a/c/mapping/mapper_put.c b/c/mapping/mapper_put.c index 5a6f20f93..38178e343 100644 --- a/c/mapping/mapper_put.c +++ b/c/mapping/mapper_put.c @@ -64,7 +64,8 @@ static void mapper_put_usage(FILE* o, char* argv0, char* verb) { fprintf(o, "Please use a dollar sign for field names and double-quotes for string\n"); fprintf(o, "literals. If field names have special characters such as \".\" then you might\n"); fprintf(o, "use braces, e.g. '${field.name}'. Miller built-in variables are\n"); - fprintf(o, "NF NR FNR FILENUM FILENAME PI E.\n"); + fprintf(o, "NF NR FNR FILENUM FILENAME PI E, and ENV[\"namegoeshere\"] to access environment\n"); + fprintf(o, "variables; the environment-variable name may be an expression, e.g. a field value.\n"); fprintf(o, "\n"); fprintf(o, "Examples:\n"); fprintf(o, " Assignment only:\n"); diff --git a/c/todo.txt b/c/todo.txt index fb70d300a..1d81e08a9 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -7,7 +7,7 @@ BUGFIXES TOP-OF-LIST SUMMARY * JSON input: UT/doc items -* env vars: UT; OLH ~ PI/E/etc. +* env vars: OLH ~ PI/E/etc. ! rh/fedora/centos mlr-3.3.2: after patch-file for manpage ? make a 3.3.3 w/ all but oosvar/begin-end/pattern-action? what to do about filter/gate which is transitional? diff --git a/doc/content-for-feature-comparison.html b/doc/content-for-feature-comparison.html index 9634c628a..4fd343590 100644 --- a/doc/content-for-feature-comparison.html +++ b/doc/content-for-feature-comparison.html @@ -34,7 +34,7 @@ put '$xy = $x * $y' or mlr put '$counter = NR'.
The $name syntax is straight from awk’s $1 $2 $3 (adapted to name-based indexing), as are the variables FS, OFS, RS, ORS, NF, NR, and -FILENAME. +FILENAME. The ENV[...] syntax is from Ruby. While awk functions are record-based, Miller subcommands (or functions, if you like) are stream-based: each of them maps a stream of records diff --git a/doc/content-for-reference.html b/doc/content-for-reference.html index 16167fc99..8de9d47c7 100644 --- a/doc/content-for-reference.html +++ b/doc/content-for-reference.html @@ -456,7 +456,8 @@ as . then you can use braces, e.g. '${field.name}'. The filter command supports the same built-in variables as for put, all awk-inspired: NF, NR, FNR, FILENUM, and FILENAME, as well as -the mathematical constants PI and E. This selects the 2nd +the mathematical constants PI and E. +This selects the 2nd record from each matching file: POKI_RUN_COMMAND{{mlr filter 'FNR == 2' data/small*}}HERE @@ -669,7 +670,7 @@ have special characters such as . then you can use braces, e.g. href="#filter">filter and put, all awk-inspired: NF, NR, FNR, FILENUM, and FILENAME, as well as the mathematical constants PI and -E. +E. The ENV[...] syntax is from Ruby.