Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

88.20. miller-6.21.0

awk for CSV, TSV and JSON — named fields instead of column numbers

Version 6.21.0, release 1
Shelf formats — Data-format and serialisation libraries (XML, JSON, YAML, TOML, INI, RDF, protobuf, thrift), plus data query and convert tools
Phase 41_system (System), 550 of 1047 in build order
Licence BSD-2-Clause
Homepage https://miller.readthedocs.io/
Build time 0.7 SBU
Installed size 19.1 MiB in 3 files
Recipe ports/core/formats/miller/kpkgbuild

About

Miller (mlr) is like awk, sed, cut, join and sort for name-indexed data: CSV, TSV, JSON, and other record formats. A field is addressed by its name instead of its column number, so mlr --icsv --opprint sort -nr price then head -n 5 shop.csv does in one line what awk needs a script for, and it converts between the formats as it goes. It is a single Go binary, built without cgo.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/formats.txt:

awk for CSV, TSV and JSON: named fields instead of column numbers, which is the difference between a one-liner and a script.

Sources

Dependencies

Depends on: go.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install miller'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/formats/miller.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/formats/miller
echo 'f92366ed67ffdbc75e8daf99a5087bcaa786c50f7c0eec08a8846e14fe7b2e5d  miller-6.21.0.tar.gz' | sha256sum -c -
echo '08b4d831038f90ff331aea734d634bc87658a3db1c9940e62b534dc44ed82163  miller-vendor-6.21.0.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/miller
SRC=$SRC_ROOT/miller-6.21.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf miller-6.21.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CGO_ENABLED=0
go build -mod=vendor -ldflags "-s -w" -o mlr ./cmd/mlr
install -Dm755 mlr $PKG/usr/bin/mlr
install -Dm644 man/mlr.1 $PKG/usr/share/man/man1/mlr.1

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/miller, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf miller-6.21.0-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/miller, and runs the triggers its paths call for.

Contents

Installed programs: mlr.

Installed directories: /usr/share/licenses/miller.

Short descriptions

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

Notes

go build is pointed at ./cmd/mlr, the main package; the top of the source tree holds only the regression test. The manual page is upstream’s pre-generated man/mlr.1, installed as it is.

The Go modules come from the vendor bundle, miller-vendor-<version>.tar.xz, made by go mod vendor and pinned by its own sha256 = line (see Vendoring).