mlr Command Examples

Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON. More information: https://johnkerl.org/miller/doc.

mlr --icsv --opprint cat {{example.csv}}

echo '{"hello":"world"}' | mlr --ijson --opprint cat

mlr --icsv --opprint sort -f {{field}} {{example.csv}}

mlr --icsv --opprint sort -nr {{field}} {{example.csv}}

mlr --icsv --ojson put '${{newField1}} = ${{oldFieldA}}/${{oldFieldB}}' {{example.csv}}

echo '{"hello":"world", "foo":"bar"}' | mlr --ijson --ojson --jvstack cat

mlr --prepipe 'gunzip' --csv filter -S '${{fieldName}} =~ "{{regular_expression}}"' {{example.csv.gz}}