LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

miller

like awk, sed, cut, join, and sort for name-indexed data such as CSV

TLDR

Convert CSV to JSON
$ mlr --csv --ojson cat [file.csv]
copy
Filter records
$ mlr --csv filter '$[field] > [10]' [file.csv]
copy
Select columns
$ mlr --csv cut -f [name,age] [file.csv]
copy
Sort by field
$ mlr --csv sort -f [age] [file.csv]
copy
Aggregate statistics
$ mlr --csv stats1 -a sum,mean -f [value] -g [category] [file.csv]
copy
Transform field
$ mlr --csv put '$[total] = $[price] * $[quantity]' [file.csv]
copy

SYNOPSIS

mlr [options] verb [verb-options] files...

DESCRIPTION

Miller (mlr) is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and JSON. It's designed for processing structured text data from the command line.Miller handles heterogeneous data formats with consistent syntax.

PARAMETERS

--csv

CSV input format.
--json
JSON input format.
--ojson
JSON output format.
--icsv --ojson
CSV in, JSON out.
cat
Pass through records.
filter
Select matching records.
cut
Select fields.
sort
Sort records.
put
Add/modify fields.
stats1
Aggregate statistics.

FORMAT CONVERSION

$ mlr --icsv --ojson cat data.csv
mlr --ijson --ocsv cat data.json
mlr --csv --opprint cat data.csv
copy

INSTALL

sudo dnf install miller
copy
sudo pacman -S miller
copy
sudo zypper install miller
copy
brew install miller
copy
nix profile install nixpkgs#miller
copy

CAVEATS

DSL syntax differs from awk. Field names are case-sensitive. Large files processed streaming.

HISTORY

Miller was created by John Kerl starting in 2015 to provide a unified tool for structured text processing.

SEE ALSO

jq(1), awk(1), csvkit(1), xsv(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid