mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-30 03:01:39 +00:00
597 lines
27 KiB
Text
597 lines
27 KiB
Text
|
|
mlr --help-all-verbs
|
|
================================================================
|
|
Usage: mlr altkv [options]
|
|
Given fields with values of the form a,b,c,d,e,f emits a=b,c=d,e=f pairs.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr bootstrap [options]
|
|
Emits an n-sample, with replacement, of the input records.
|
|
See also mlr sample and mlr shuffle.
|
|
Options:
|
|
-n Number of samples to output. Defaults to number of input records.
|
|
Must be non-negative.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr cat [options]
|
|
Passes input records directly to output. Most useful for format conversion.
|
|
Options:
|
|
-n Prepend field "n" to each record with record-counter starting at 1.
|
|
-N {name} Prepend field {name} to each record with record-counter starting at 1.
|
|
-g {a,b,c} Optional group-by-field names for counters, e.g. a,b,c
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr check [options]
|
|
Consumes records without printing any output.
|
|
Useful for doing a well-formatted check on input data.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr clean-whitespace [options]
|
|
For each record, for each field in the record, whitespace-cleans the keys and/or
|
|
values. Whitespace-cleaning entails stripping leading and trailing whitespace,
|
|
and replacing multiple whitespace with singles. For finer-grained control,
|
|
please see the DSL functions lstrip, rstrip, strip, collapse_whitespace,
|
|
and clean_whitespace.
|
|
|
|
Options:
|
|
-k|--keys-only Do not touch values.
|
|
-v|--values-only Do not touch keys.
|
|
It is an error to specify -k as well as -v -- to clean keys and values,
|
|
leave off -k as well as -v.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr count [options]
|
|
Prints number of records, optionally grouped by distinct values for specified field names.
|
|
Options:
|
|
-g {a,b,c} Optional group-by-field names for counts, e.g. a,b,c
|
|
-n {n} Show only the number of distinct values. Not interesting without -g.
|
|
-o {name} Field name for output-count. Default "count".
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr count-similar [options]
|
|
Ingests all records, then emits each record augmented by a count of
|
|
the number of other records having the same group-by field values.
|
|
Options:
|
|
-g {a,b,c} Group-by-field names for counts, e.g. a,b,c
|
|
-o {name} Field name for output-counts. Defaults to "count".
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr cut [options]
|
|
Passes through input records with specified fields included/excluded.
|
|
Options:
|
|
-f {a,b,c} Comma-separated field names for cut, e.g. a,b,c.
|
|
-o Retain fields in the order specified here in the argument list.
|
|
Default is to retain them in the order found in the input data.
|
|
-x|--complement Exclude, rather than include, field names specified by -f.
|
|
-r Treat field names as regular expressions. "ab", "a.*b" will
|
|
match any field name containing the substring "ab" or matching
|
|
"a.*b", respectively; anchors of the form "^ab$", "^a.*b$" may
|
|
be used. The -o flag is ignored when -r is present.
|
|
-h|--help Show this message.
|
|
Examples:
|
|
mlr cut -f hostname,status
|
|
mlr cut -x -f hostname,status
|
|
mlr cut -r -f '^status$,sda[0-9]'
|
|
mlr cut -r -f '^status$,"sda[0-9]"'
|
|
mlr cut -r -f '^status$,"sda[0-9]"i' (this is case-insensitive)
|
|
================================================================
|
|
Usage: mlr decimate [options]
|
|
Passes through one of every n records, optionally by category.
|
|
Options:
|
|
-b Decimate by printing first of every n.
|
|
-e Decimate by printing last of every n (default).
|
|
-g {a,b,c} Optional group-by-field names for decimate counts, e.g. a,b,c.
|
|
-n {n} Decimation factor (default 10).
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr fill-down [options]
|
|
If a given record has a missing value for a given field, fill that from
|
|
|
|
the corresponding value from a previous record, if any.
|
|
By default, a 'missing' field either is absent, or has the empty-string value.
|
|
With -a, a field is 'missing' only if it is absent.
|
|
|
|
Options:
|
|
-a|--only-if-absent If a given record has a missing value for a given field,
|
|
fill that from the corresponding value from a previous record, if any.
|
|
By default, a 'missing' field either is absent, or has the empty-string value.
|
|
With -a, a field is 'missing' only if it is absent.
|
|
-f Field names for fill-down.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr filter [options] {DSL expression}
|
|
Options:
|
|
-f {file name} File containing a DSL expression.
|
|
|
|
-e {expression} You can use this after -f to add an expression. Example use
|
|
case: define functions/subroutines in a file you specify with -f, then call
|
|
them with an expression you specify with -e.
|
|
|
|
(If you mix -e and -f then the expressions are evaluated in the order encountered.
|
|
Since the expression pieces are simply concatenated, please be sure to use intervening
|
|
semicolons to separate expressions.)
|
|
|
|
-s name=value: Predefines out-of-stream variable @name to have
|
|
Thus mlr put -s foo=97 '$column += @foo' is like
|
|
mlr put 'begin {@foo = 97} $column += @foo'.
|
|
The value part is subject to type-inferencing.
|
|
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
|
|
|
|
-x (default false) Prints records for which {expression} evaluates to false, not true,
|
|
i.e. invert the sense of the filter expression.
|
|
|
|
-q Does not include the modified record in the output stream.
|
|
Useful for when all desired output is in begin and/or end blocks.
|
|
|
|
-v Prints the expressions's AST (abstract syntax tree), which gives
|
|
full transparency on the precedence and associativity rules of
|
|
Miller's grammar, to stdout.
|
|
|
|
-d Like -v but uses a parenthesized-expression format for the AST. Then, exits without
|
|
stream processing.
|
|
|
|
-D Like -d but with output all on one line.
|
|
|
|
-S and -F: There are no-ops in Miller 6 and above, since now type-inferencing is done
|
|
by the record-readers before filter/put is executed. Supported as no-op pass-through
|
|
flags for backward compatibility.
|
|
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr flatten [options]
|
|
Flattens multi-level maps to single-level ones. Example: field with name 'a'
|
|
and value '{"b": { "c": 4 }}' becomes name 'a:b:c' and value 4.
|
|
Options:
|
|
-f Comma-separated list of field names to flatten (default all).
|
|
-s Separator, defaulting to mlr --oflatsep value.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr gap [options]
|
|
Emits an empty record every n records, or when certain values change.
|
|
Options:
|
|
Emits an empty record every n records, or when certain values change.
|
|
-g {a,b,c} Print a gap whenever values of these fields (e.g. a,b,c) changes.
|
|
-n {n} Print a gap every n records.
|
|
One of -f or -g is required.
|
|
-n is ignored if -g is present.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr grep [options] {regular expression}
|
|
Passes through records which match the regular expression.
|
|
Options:
|
|
-i Use case-insensitive search.
|
|
-v Invert: pass through records which do not match the regex.
|
|
-h|--help Show this message.
|
|
Note that "mlr filter" is more powerful, but requires you to know field names.
|
|
By contrast, "mlr grep" allows you to regex-match the entire record. It does
|
|
this by formatting each record in memory as DKVP, using command-line-specified
|
|
ORS/OFS/OPS, and matching the resulting line against the regex specified
|
|
here. In particular, the regex is not applied to the input stream: if you
|
|
have CSV with header line "x,y,z" and data line "1,2,3" then the regex will
|
|
be matched, not against either of these lines, but against the DKVP line
|
|
"x=1,y=2,z=3". Furthermore, not all the options to system grep are supported,
|
|
and this command is intended to be merely a keystroke-saver. To get all the
|
|
features of system grep, you can do
|
|
"mlr --odkvp ... | grep ... | mlr --idkvp ..."
|
|
================================================================
|
|
Usage: mlr group-by [options] {comma-separated field names}
|
|
Outputs records in batches having identical values at specified field names.Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr group-like [options]
|
|
Outputs records in batches having identical field names.Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr having-fields [options]
|
|
Conditionally passes through records depending on each record's field names.
|
|
Options:
|
|
--at-least {comma-separated names}
|
|
--which-are {comma-separated names}
|
|
--at-most {comma-separated names}
|
|
--all-matching {regular expression}
|
|
--any-matching {regular expression}
|
|
--none-matching {regular expression}
|
|
Examples:
|
|
mlr having-fields --which-are amount,status,owner
|
|
mlr having-fields --any-matching 'sda[0-9]'
|
|
mlr having-fields --any-matching '"sda[0-9]"'
|
|
mlr having-fields --any-matching '"sda[0-9]"i' (this is case-insensitive)
|
|
================================================================
|
|
Usage: mlr head [options]
|
|
Passes through the first n records, optionally by category.
|
|
Options:
|
|
-g {a,b,c} Optional group-by-field names for head counts, e.g. a,b,c.
|
|
-n {n} Head-count to print. Default 10.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr join [options]
|
|
Joins records from specified left file name with records from all file names
|
|
at the end of the Miller argument list.
|
|
Functionality is essentially the same as the system "join" command, but for
|
|
record streams.
|
|
Options:
|
|
-f {left file name}
|
|
-j {a,b,c} Comma-separated join-field names for output
|
|
-l {a,b,c} Comma-separated join-field names for left input file;
|
|
defaults to -j values if omitted.
|
|
-r {a,b,c} Comma-separated join-field names for right input file(s);
|
|
defaults to -j values if omitted.
|
|
--lp {text} Additional prefix for non-join output field names from
|
|
the left file
|
|
--rp {text} Additional prefix for non-join output field names from
|
|
the right file(s)
|
|
--np Do not emit paired records
|
|
--ul Emit unpaired records from the left file
|
|
--ur Emit unpaired records from the right file(s)
|
|
-s|--sorted-input Require sorted input: records must be sorted
|
|
lexically by their join-field names, else not all records will
|
|
be paired. The only likely use case for this is with a left
|
|
file which is too big to fit into system memory otherwise.
|
|
-u Enable unsorted input. (This is the default even without -u.)
|
|
In this case, the entire left file will be loaded into memory.
|
|
--prepipe {command} As in main input options; see mlr --help for details.
|
|
If you wish to use a prepipe command for the main input as well
|
|
as here, it must be specified there as well as here.
|
|
-h|--help Show this message.
|
|
|
|
File-format options default to those for the right file names on the Miller
|
|
argument list, but may be overridden for the left file as follows. Please see
|
|
the main "mlr --help" for more information on syntax for these arguments.
|
|
-i {one of csv,dkvp,nidx,pprint,xtab}
|
|
--irs {record-separator character}
|
|
--ifs {field-separator character}
|
|
--ips {pair-separator character}
|
|
--repifs
|
|
--repips
|
|
Please use "mlr --usage-separator-options" for information on specifying separators.
|
|
Please see https://miller.readthedocs.io/en/latest/reference-verbs.html#join for more information
|
|
including examples.
|
|
================================================================
|
|
Usage: mlr json-parse [options]
|
|
Tries to convert string field values to parsed JSON, e.g. "[1,2,3]" -> [1,2,3].
|
|
Options:
|
|
-f {...} Comma-separated list of field names to json-parse (default all).
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr json-stringify [options]
|
|
Produces string field values from field-value data, e.g. [1,2,3] -> "[1,2,3]".
|
|
Options:
|
|
-f {...} Comma-separated list of field names to json-parse (default all).
|
|
--jvstack Produce multi-line JSON output.
|
|
--no-jvstack Produce single-line JSON output per record (default).
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr label [options] {new1,new2,new3,...}
|
|
Given n comma-separated names, renames the first n fields of each record to
|
|
have the respective name. (Fields past the nth are left with their original
|
|
names.) Particularly useful with --inidx or --implicit-csv-header, to give
|
|
useful names to otherwise integer-indexed fields.
|
|
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr nothing [options]
|
|
Drops all input records. Useful for testing, or after tee/print/etc. have
|
|
produced other output.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr put [options] {DSL expression}
|
|
Options:
|
|
-f {file name} File containing a DSL expression.
|
|
|
|
-e {expression} You can use this after -f to add an expression. Example use
|
|
case: define functions/subroutines in a file you specify with -f, then call
|
|
them with an expression you specify with -e.
|
|
|
|
(If you mix -e and -f then the expressions are evaluated in the order encountered.
|
|
Since the expression pieces are simply concatenated, please be sure to use intervening
|
|
semicolons to separate expressions.)
|
|
|
|
-s name=value: Predefines out-of-stream variable @name to have
|
|
Thus mlr put -s foo=97 '$column += @foo' is like
|
|
mlr put 'begin {@foo = 97} $column += @foo'.
|
|
The value part is subject to type-inferencing.
|
|
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
|
|
|
|
-x (default false) Prints records for which {expression} evaluates to false, not true,
|
|
i.e. invert the sense of the filter expression.
|
|
|
|
-q Does not include the modified record in the output stream.
|
|
Useful for when all desired output is in begin and/or end blocks.
|
|
|
|
-v Prints the expressions's AST (abstract syntax tree), which gives
|
|
full transparency on the precedence and associativity rules of
|
|
Miller's grammar, to stdout.
|
|
|
|
-d Like -v but uses a parenthesized-expression format for the AST. Then, exits without
|
|
stream processing.
|
|
|
|
-D Like -d but with output all on one line.
|
|
|
|
-S and -F: There are no-ops in Miller 6 and above, since now type-inferencing is done
|
|
by the record-readers before filter/put is executed. Supported as no-op pass-through
|
|
flags for backward compatibility.
|
|
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr repeat [options]
|
|
Copies input records to output records multiple times.
|
|
Options must be exactly one of the following:
|
|
-n {repeat count} Repeat each input record this many times.
|
|
-f {field name} Same, but take the repeat count from the specified
|
|
field name of each input record.
|
|
-h|--help Show this message.
|
|
Example:
|
|
echo x=0 | mlr repeat -n 4 then put '$x=urand()'
|
|
produces:
|
|
x=0.488189
|
|
x=0.484973
|
|
x=0.704983
|
|
x=0.147311
|
|
Example:
|
|
echo a=1,b=2,c=3 | mlr repeat -f b
|
|
produces:
|
|
a=1,b=2,c=3
|
|
a=1,b=2,c=3
|
|
Example:
|
|
echo a=1,b=2,c=3 | mlr repeat -f c
|
|
produces:
|
|
a=1,b=2,c=3
|
|
a=1,b=2,c=3
|
|
a=1,b=2,c=3
|
|
================================================================
|
|
Usage: mlr regularize [options]
|
|
Outputs records sorted lexically ascending by keys.Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr remove-empty-columns [options]
|
|
Omits fields which are empty on every input row. Non-streaming.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr rename [options] {old1,new1,old2,new2,...}
|
|
Renames specified fields.
|
|
Options:
|
|
-r Treat old field names as regular expressions. "ab", "a.*b"
|
|
will match any field name containing the substring "ab" or
|
|
matching "a.*b", respectively; anchors of the form "^ab$",
|
|
"^a.*b$" may be used. New field names may be plain strings,
|
|
or may contain capture groups of the form "\1" through
|
|
"\9". Wrapping the regex in double quotes is optional, but
|
|
is required if you wish to follow it with 'i' to indicate
|
|
case-insensitivity.
|
|
-g Do global replacement within each field name rather than
|
|
first-match replacement.
|
|
-h|--help Show this message.
|
|
Examples:
|
|
mlr rename old_name,new_name'
|
|
mlr rename old_name_1,new_name_1,old_name_2,new_name_2'
|
|
mlr rename -r 'Date_[0-9]+,Date,' Rename all such fields to be "Date"
|
|
mlr rename -r '"Date_[0-9]+",Date' Same
|
|
mlr rename -r 'Date_([0-9]+).*,\1' Rename all such fields to be of the form 20151015
|
|
mlr rename -r '"name"i,Name' Rename "name", "Name", "NAME", etc. to "Name"
|
|
================================================================
|
|
Usage: mlr reorder [options]
|
|
Moves specified names to start of record, or end of record.
|
|
Options:
|
|
-e Put specified field names at record end: default is to put them at record start.
|
|
-f {a,b,c} Field names to reorder.
|
|
-h|--help Show this message.
|
|
|
|
Examples:
|
|
mlr reorder -f a,b sends input record "d=4,b=2,a=1,c=3" to "a=1,b=2,d=4,c=3".
|
|
mlr reorder -e -f a,b sends input record "d=4,b=2,a=1,c=3" to "d=4,c=3,a=1,b=2".
|
|
================================================================
|
|
Usage: mlr sample [options]
|
|
Reservoir sampling (subsampling without replacement), optionally by category.
|
|
See also mlr bootstrap and mlr shuffle.
|
|
Options:
|
|
-g {a,b,c} Optional: group-by-field names for samples, e.g. a,b,c.
|
|
-k {k} Required: number of records to output in total, or by group if using -g.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr sec2gmt [options] {comma-separated list of field names}
|
|
Replaces a numeric field representing seconds since the epoch with the
|
|
corresponding GMT timestamp; leaves non-numbers as-is. This is nothing
|
|
more than a keystroke-saver for the sec2gmt function:
|
|
mlr sec2gmt time1,time2
|
|
is the same as
|
|
mlr put '$time1 = sec2gmt($time1); $time2 = sec2gmt($time2)'
|
|
Options:
|
|
-1 through -9: format the seconds using 1..9 decimal places, respectively.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr seqgen [options]
|
|
Passes input records directly to output. Most useful for format conversion.
|
|
Produces a sequence of counters. Discards the input record stream. Produces
|
|
output as specified by the options
|
|
|
|
Options:
|
|
-f {name} (default "i") Field name for counters.
|
|
-start {value} (default 1) Inclusive start value.
|
|
-step {value} (default 1) Step value.
|
|
-stop {value} (default 100) Inclusive stop value.
|
|
-h|--help Show this message.
|
|
Start, stop, and/or step may be floating-point. Output is integer if start,
|
|
stop, and step are all integers. Step may be negative. It may not be zero
|
|
unless start == stop.
|
|
================================================================
|
|
Usage: mlr shuffle [options]
|
|
Outputs records randomly permuted. No output records are produced until
|
|
all input records are read. See also mlr bootstrap and mlr sample.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr skip-trivial-records [options]
|
|
Passes through all records except those with zero fields,
|
|
or those for which all fields have empty value.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr sort {flags}
|
|
Sorts records primarily by the first specified field, secondarily by the second
|
|
field, and so on. (Any records not having all specified sort keys will appear
|
|
at the end of the output, in the order they were encountered, regardless of the
|
|
specified sort order.) The sort is stable: records that compare equal will sort
|
|
in the order they were encountered in the input record stream.
|
|
|
|
Options:
|
|
-f {comma-separated field names} Lexical ascending
|
|
-n {comma-separated field names} Numerical ascending; nulls sort last
|
|
-nf {comma-separated field names} Same as -n
|
|
-r {comma-separated field names} Lexical descending
|
|
-nr {comma-separated field names} Numerical descending; nulls sort first
|
|
-h|--help Show this message.
|
|
|
|
Example:
|
|
mlr sort -f a,b -nr x,y,z
|
|
which is the same as:
|
|
mlr sort -f a -f b -nr x -nr y -nr z
|
|
================================================================
|
|
Usage: mlr sort-within-records [options]
|
|
Outputs records sorted lexically ascending by keys.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr stats1 [options]
|
|
Computes univariate statistics for one or more given fields, accumulated across
|
|
the input record stream.
|
|
Options:
|
|
-a {sum,count,...} Names of accumulators: one or more of:
|
|
median This is the same as p50
|
|
p10 p25.2 p50 p98 p100 etc.
|
|
TODO: flags for interpolated percentiles
|
|
count Count instances of fields
|
|
mode Find most-frequently-occurring values for fields; first-found wins tie
|
|
antimode Find least-frequently-occurring values for fields; first-found wins tie
|
|
sum Compute sums of specified fields
|
|
mean Compute averages (sample means) of specified fields
|
|
var Compute sample variance of specified fields
|
|
stddev Compute sample standard deviation of specified fields
|
|
meaneb Estimate error bars for averages (assuming no sample autocorrelation)
|
|
skewness Compute sample skewness of specified fields
|
|
kurtosis Compute sample kurtosis of specified fields
|
|
min Compute minimum values of specified fields
|
|
max Compute maximum values of specified fields
|
|
|
|
-f {a,b,c} Value-field names on which to compute statistics
|
|
-g {d,e,f} Optional group-by-field names
|
|
|
|
-i Use interpolated percentiles, like R's type=7; default like type=1.\n");
|
|
Not sensical for string-valued fields.\n");
|
|
-s Print iterative stats. Useful in tail -f contexts (in which
|
|
case please avoid pprint-format output since end of input
|
|
stream will never be seen).
|
|
-h|--help Show this message.
|
|
[TODO: more]
|
|
Example: mlr stats1 -a min,p10,p50,p90,max -f value -g size,shape
|
|
mlr stats1
|
|
Example: mlr stats1 -a count,mode -f size
|
|
mlr stats1
|
|
Example: mlr stats1 -a count,mode -f size -g shape
|
|
mlr stats1
|
|
Example: mlr stats1 -a count,mode --fr '^[a-h].*$' -gr '^k.*$'
|
|
mlr stats1
|
|
This computes count and mode statistics on all field names beginning
|
|
with a through h, grouped by all field names starting with k.
|
|
|
|
Notes:
|
|
* p50 and median are synonymous.
|
|
* min and max output the same results as p0 and p100, respectively, but use
|
|
less memory.
|
|
* String-valued data make sense unless arithmetic on them is required,
|
|
e.g. for sum, mean, interpolated percentiles, etc. In case of mixed data,
|
|
numbers are less than strings.
|
|
* count and mode allow text input; the rest require numeric input.
|
|
In particular, 1 and 1.0 are distinct text for count and mode.
|
|
* When there are mode ties, the first-encountered datum wins.
|
|
================================================================
|
|
Usage: mlr step [options]
|
|
Computes values dependent on the previous record, optionally grouped by category.
|
|
Options:
|
|
-a {delta,rsum,...} Names of steppers: comma-separated, one or more of:
|
|
delta Compute differences in field(s) between successive records
|
|
shift Include value(s) in field(s) from previous record, if any
|
|
from-first Compute differences in field(s) from first record
|
|
ratio Compute ratios in field(s) between successive records
|
|
rsum Compute running sums of field(s) between successive records
|
|
counter Count instances of field(s) between successive records
|
|
ewma Exponentially weighted moving average over successive records
|
|
|
|
-f {a,b,c} Value-field names on which to compute statistics
|
|
-g {d,e,f} Optional group-by-field names
|
|
-F Computes integerable things (e.g. counter) in floating point.
|
|
As of Miller 6 this happens automatically, but the flag is accepted
|
|
as a no-op for backward compatibility with Miller 5 and below.
|
|
-d {x,y,z} Weights for ewma. 1 means current sample gets all weight (no
|
|
smoothing), near under under 1 is light smoothing, near over 0 is
|
|
heavy smoothing. Multiple weights may be specified, e.g.
|
|
"mlr step -a ewma -f sys_load -d 0.01,0.1,0.9". Default if omitted
|
|
is "-d 0.5".
|
|
-o {a,b,c} Custom suffixes for EWMA output fields. If omitted, these default to
|
|
the -d values. If supplied, the number of -o values must be the same
|
|
as the number of -d values.
|
|
-h|--help Show this message.
|
|
|
|
Examples:
|
|
mlr step -a rsum -f request_size
|
|
mlr step -a delta -f request_size -g hostname
|
|
mlr step -a ewma -d 0.1,0.9 -f x,y
|
|
mlr step -a ewma -d 0.1,0.9 -o smooth,rough -f x,y
|
|
mlr step -a ewma -d 0.1,0.9 -o smooth,rough -f x,y -g group_name
|
|
|
|
Please see https://miller.readthedocs.io/en/latest/reference-verbs.html#filter or
|
|
https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
|
|
for more information on EWMA.
|
|
================================================================
|
|
Usage: mlr tac [options]
|
|
Prints records in reverse order from the order in which they were encountered.
|
|
Options:
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr tee [options] {filename}
|
|
Options:
|
|
-a Append to existing file, if any, rather than overwriting.
|
|
-p Treat filename as a pipe-to command.
|
|
Any of the output-format command-line flags (see mlr -h). Example: using
|
|
mlr --icsv --opprint put '...' then tee --ojson ./mytap.dat then stats1 ...
|
|
the input is CSV, the output is pretty-print tabular, but the tee-file output
|
|
is written in JSON format.
|
|
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr tail [options]
|
|
Passes through the last n records, optionally by category.
|
|
Options:
|
|
-g {a,b,c} Optional group-by-field names for head counts, e.g. a,b,c.
|
|
-n {n} Head-count to print. Default 10.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr unflatten [options]
|
|
Reverses flatten. Example: field with name 'a:b:c' and value 4
|
|
becomes name 'a' and value '{"b": { "c": 4 }}'.
|
|
Options:
|
|
-f {a,b,c} Comma-separated list of field names to unflatten (default all).
|
|
-s {string} Separator, defaulting to mlr --oflatsep value.
|
|
-h|--help Show this message.
|
|
================================================================
|
|
Usage: mlr unsparsify [options]
|
|
Prints records with the union of field names over all input records.
|
|
For field names absent in a given record but present in others, fills in
|
|
a value. This verb retains all input before producing any output.
|
|
Options:
|
|
--fill-with {filler string} What to fill absent fields with. Defaults to
|
|
the empty string.
|
|
-f {a,b,c} Specify field names to be operated on. Any other fields won't be
|
|
modified, and operation will be streaming.
|
|
-h|--help Show this message.
|
|
Example: if the input is two records, one being 'a=1,b=2' and the other
|
|
being 'b=3,c=4', then the output is the two records 'a=1,b=2,c=' and
|
|
'a=,b=3,c=4'.
|
|
================================================================
|
|
|