LinuxCommandLibrary

mlr

TLDR

Convert CSV to JSON

$ mlr --csv --ojson cat [data.csv]
copy
Filter records
$ mlr --csv filter '$status == "active"' [data.csv]
copy
Select fields
$ mlr --csv cut -f [name,email] [data.csv]
copy
Sort records
$ mlr --csv sort -f [age] [data.csv]
copy
Calculate statistics
$ mlr --csv stats1 -a mean -f [price] [data.csv]
copy
Transform field
$ mlr --csv put '$total = $price * $quantity' [data.csv]
copy

SYNOPSIS

mlr [options] verbs file

DESCRIPTION

mlr (Miller) processes structured text data. It handles CSV, JSON, and other formats.
The tool provides awk-like processing for structured data. Powerful for data transformation.
mlr processes structured data.

PARAMETERS

VERBS

Operations to perform.
--csv
CSV format.
--json
JSON format.
--ojson
Output as JSON.
filter
Filter records.
cut
Select fields.
sort
Sort records.
--help
Display help information.

CAVEATS

Many verbs to learn. Format-aware. Go-based rewrite.

HISTORY

Miller was created by John Kerl as "like awk/sed/cut for name-indexed data."

SEE ALSO

jq(1), awk(1), csvtool(1)

Copied to clipboard