mlr

mlr

TLDR

Pretty-print a CSV file in a tabular format

>_ mlr --icsv --opprint cat [example.csv]
copy

Receive JSON data and pretty print the output

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

Sort alphabetically on a field

>_ mlr --icsv --opprint sort -f [field] [example.csv]
copy

Sort in descending numerical order on a field

>_ mlr --icsv --opprint sort -nr [field] [example.csv]
copy

Convert CSV to JSON, performing calculations and display those calculations

>_ mlr --icsv --ojson put '$[newField1] = $[oldFieldA]/$[oldFieldB]' [example.csv]
copy

Receive JSON and format the output as vertical JSON

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

Filter lines of a compressed CSV file treating numbers as strings

>_ mlr --prepipe 'gunzip' --csv filter -S '$[fieldName] =~ "[regexp]"' [example.csv.gz]
copy

Copied to clipboard
free 100$ digital ocean credit