README.md
Miller is like awk, sed, cut, join, and sort for data formats such as CSV, TSV, JSON, JSON Lines, and positionally-indexed.
With Miller, you get to use named fields without needing to count positional indices, using familiar formats such as CSV, TSV, JSON, JSON Lines, and positionally-indexed. Then, on the fly, you can add new fields which are functions of existing fields, drop fields, sort, aggregate statistically, pretty-print, and more.
Miller operates on key-value-pair data while the familiar Unix tools operate on integer-indexed fields: if the natural data structure for the latter is the array, then Miller's natural data structure is the insertion-ordered hash map.
Miller handles a variety of data formats, including but not limited to the familiar CSV, TSV, and JSON/JSON Lines. (Miller can handle positionally-indexed data too!)
In the above image you can see how Miller embraces the common themes of key-value-pair data in a variety of data formats.
There's a good chance you can get Miller pre-built for your system:
| OS | Installation command |
|---|---|
| Linux | yum install miller |
apt-get install miller | |
snap install miller | |
| Mac | brew install miller |
port install miller | |
| Windows | choco install miller |
winget install Miller.Miller | |
scoop install main/miller |
See also README-versions.md for a full list of package versions. Note that long-term-support (LtS) releases will likely be on older versions.
See also building from source.
cd /where/you/want/to/put/the/sourcegit clone https://github.com/johnkerl/millercd millermake:
make. This takes just a few seconds and produces the Miller executable, which is ./mlr (or .\mlr.exe on Windows).make check.make install. This installs the executable /usr/local/bin/mlr and manual page /usr/local/share/man/man1/mlr.1 (so you can do man mlr)../configure --prefix=/some/install/path before make install if you want to install somewhere other than /usr/local.make:
go build github.com/johnkerl/miller/v6/cmd/mlr.go test github.com/johnkerl/miller/v6/pkg/... and mlr regtest.go install github.com/johnkerl/miller/v6/cmd/mlr@latest will install to GOPATH/bin/mlr.Miller is multi-purpose: it's useful for data cleaning, data reduction, statistical reporting, devops, system administration, log-file processing, format conversion, and database-query post-processing.
You can use Miller to snarf and munge log-file data, including selecting out relevant substreams, then produce CSV format and load that into all-in-memory/data-frame utilities for further statistical and/or graphical processing.
Miller complements data-analysis tools such as R, pandas, etc.: you can use Miller to clean and prepare your data. While you can do basic statistics entirely in Miller, its streaming-data feature and single-pass algorithms enable you to reduce very large data sets.
Miller complements SQL databases: you can slice, dice, and reformat data on the client side on its way into or out of a database. You can also reap some of the benefits of databases for quick, setup-free one-off tasks when you just need to query some data in disk files in a hurry.
Miller also goes beyond the classic Unix tools by stepping fully into our modern, no-SQL world: its essential record-heterogeneity property allows Miller to operate on data where records with different schema (field names) are interleaved.
Miller is streaming: most operations need only a single record in
memory at a time, rather than ingesting all input before producing any output.
For those operations which require deeper retention (sort, tac, stats1),
Miller retains only as much data as needed. This means that whenever
functionally possible, you can operate on files which are larger than your
system’s available RAM, and you can use Miller in tail -f contexts.
Miller is pipe-friendly and interoperates with the Unix toolkit.
Miller's I/O formats include tabular pretty-printing, positionally indexed (Unix-toolkit style), CSV, TSV, JSON, JSON Lines, and others.
Miller does conversion between formats.
Miller's processing is format-aware: e.g. CSV sort and tac keep header lines first.
Miller has high-throughput performance on par with the Unix toolkit.
Miller is written in portable, modern Go, with zero runtime dependencies.
You can download or compile a single binary, scp it to a faraway machine,
and expect it to work.
Also, "Miller complements data-analysis tools such as R, pandas, etc.: you can use Miller to clean and prepare your data." <a href="https://twitter.com/GreatBlueC?ref_src=twsrc%5Etfw">@GreatBlueC</a> <a href="https://twitter.com/nfmcclure?ref_src=twsrc%5Etfw">@nfmcclure</a></p>— Adrien Trouillaud (@adrienjt) <a href="https://twitter.com/adrienjt/status/1308963056592891904?ref_src=twsrc%5Etfw">September 24, 2020</a></blockquote>
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Underappreciated swiss-army command-line chainsaw."Miller is like awk, sed, cut, join, and sort for [...] CSV, TSV, and [...] JSON." <a href="https://t.co/TrQqSUK3KK">https://t.co/TrQqSUK3KK</a></p>— Dirk Eddelbuettel (@eddelbuettel) <a href="https://twitter.com/eddelbuettel/status/836555980771061760?ref_src=twsrc%5Etfw">February 28, 2017</a></blockquote>
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Miller looks like a great command line tool for working with CSV data. Sed, awk, cut, join all rolled into one: <a href="http://t.co/9BBb6VCZ6Y">http://t.co/9BBb6VCZ6Y</a></p>— Mike Loukides (@mikeloukides) <a href="https://twitter.com/mikeloukides/status/632885317389950976?ref_src=twsrc%5Etfw">August 16, 2015</a></blockquote> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV: <a href="http://t.co/1zPbfg6B2W">http://t.co/1zPbfg6B2W</a> - handy tool!</p>— Ilya Grigorik (@igrigorik) <a href="https://twitter.com/igrigorik/status/635134857283153920?ref_src=twsrc%5Etfw">August 22, 2015</a></blockquote> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">Btw, I think Miller is the best CLI tool to deal with CSV. I used to use this when I need to preprocess too big CSVs to load into R (now we have vroom, so such cases might be rare, though...)<a href="https://t.co/kUjrSSGJoT">https://t.co/kUjrSSGJoT</a></p>— Hiroaki Yutani (@yutannihilat_en) <a href="https://twitter.com/yutannihilat_en/status/1252392795676934144?ref_src=twsrc%5Etfw">April 21, 2020</a></blockquote> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">Miller: a *format-aware* data munging tool By <a href="https://twitter.com/__jo_ker__?ref_src=twsrc%5Etfw">@__jo_ker__</a> to overcome limitations with *line-aware* workshorses like awk, sed et al <a href="https://t.co/LCyPkhYvt9">https://t.co/LCyPkhYvt9</a>The project website is a fantastic example of good software documentation!!</p>— Donny Daniel (@dnnydnl) <a href="https://twitter.com/dnnydnl/status/1038883999391932416?ref_src=twsrc%5Etfw">September 9, 2018</a></blockquote>
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Holy holly data swiss army knife batman! How did no one suggest Miller <a href="https://t.co/JGQpmRAZLv">https://t.co/JGQpmRAZLv</a> for solving database cleaning / ETL issues to me beforeCongrats to <a href="https://twitter.com/__jo_ker__?ref_src=twsrc%5Etfw">@jo_ker</a> for amazingly intuitive tool for critical data management tasks!<a href="https://twitter.com/hashtag/DataScienceandLaw?src=hash&ref_src=twsrc%5Etfw">#DataScienceandLaw</a> <a href="https://twitter.com/hashtag/ComputationalLaw?src=hash&ref_src=twsrc%5Etfw">#ComputationalLaw</a></p>— James Miller (@japanlawprof) <a href="https://twitter.com/japanlawprof/status/1006547451409518597?ref_src=twsrc%5Etfw">June 12, 2018</a></blockquote>
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">🤯<a href="https://twitter.com/__jo_ker__?ref_src=twsrc%5Etfw">@__jo_ker__</a>'s Miller easily reads, transforms, + writes all sorts of tabular data. It's standalone, fast, and built for streaming data (operating on one line at a time, so you can work on files larger than memory).And the docs are dream. I've been reading them all morning! <a href="https://t.co/Be2pGPZK6t">https://t.co/Be2pGPZK6t</a></p>— Benjamin Wolfe (he/him) (@BenjaminWolfe) <a href="https://twitter.com/BenjaminWolfe/status/1435966268499128324?ref_src=twsrc%5Etfw">September 9, 2021</a></blockquote>
Thanks to all the fine people who help make Miller better (emoji key):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tr> <td align="center"><a href="https://github.com/aborruso"> <sub><b>Andrea Borruso</b></sub></a> <a href="#ideas-aborruso" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-aborruso" title="Design">🎨</a></td> <td align="center"><a href="https://sjackman.ca/"> <sub><b>Shaun Jackman</b></sub></a> <a href="#ideas-sjackman" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="http://www.fredtrotter.com/"> <sub><b>Fred Trotter</b></sub></a> <a href="#ideas-ftrotter" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-ftrotter" title="Design">🎨</a></td> <td align="center"><a href="https://github.com/Komosa"> <sub><b>komosa</b></sub></a> <a href="#ideas-Komosa" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/jungle-boogie"> <sub><b>jungle-boogie</b></sub></a> <a href="#ideas-jungle-boogie" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/0-wiz-0"> <sub><b>Thomas Klausner</b></sub></a> <a href="#infra-0-wiz-0" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td> <td align="center"><a href="https://github.com/skitt"> <sub><b>Stephen Kitt</b></sub></a> <a href="#platform-skitt" title="Packaging/porting to new platform">📦</a></td> </tr> <tr> <td align="center"><a href="http://leahneukirchen.org/"> <sub><b>Leah Neukirchen</b></sub></a> <a href="#ideas-leahneukirchen" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/lgbaldoni"> <sub><b>Luigi Baldoni</b></sub></a> <a href="#platform-lgbaldoni" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://yutani.rbind.io/"> <sub><b>Hiroaki Yutani</b></sub></a> <a href="#ideas-yutannihilation" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://3e.org/"> <sub><b>Daniel M. Drucker</b></sub></a> <a href="#ideas-dmd" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/NikosAlexandris"> <sub><b>Nikos Alexandris</b></sub></a> <a href="#ideas-NikosAlexandris" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/kundeng"> <sub><b>kundeng</b></sub></a> <a href="#platform-kundeng" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="http://victorsergienko.com/"> <sub><b>Victor Sergienko</b></sub></a> <a href="#platform-singalen" title="Packaging/porting to new platform">📦</a></td> </tr> <tr> <td align="center"><a href="https://github.com/gromgit"> <sub><b>Adrian Ho</b></sub></a> <a href="#design-gromgit" title="Design">🎨</a></td> <td align="center"><a href="https://github.com/Zachp"> <sub><b>zachp</b></sub></a> <a href="#platform-Zachp" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://dsel.net/"> <sub><b>David Selassie</b></sub></a> <a href="#ideas-davidselassie" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="http://www.joelparkerhenderson.com/"> <sub><b>Joel Parker Henderson</b></sub></a> <a href="#ideas-joelparkerhenderson" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/divtiply"> <sub><b>Michel Ace</b></sub></a> <a href="#ideas-divtiply" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="http://fuco1.github.io/sitemap.html"> <sub><b>Matus Goljer</b></sub></a> <a href="#ideas-Fuco1" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/terorie"> <sub><b>Richard Patel</b></sub></a> <a href="#platform-terorie" title="Packaging/porting to new platform">📦</a></td> </tr> <tr> <td align="center"><a href="https://blog.kub1x.org/"> <sub><b>Jakub Podlaha</b></sub></a> <a href="#design-kub1x" title="Design">🎨</a></td> <td align="center"><a href="https://goo.gl/ZGZynx"> <sub><b>Miodrag Milić</b></sub></a> <a href="#platform-majkinetor" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://github.com/derekmahar"> <sub><b>Derek Mahar</b></sub></a> <a href="#ideas-derekmahar" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/spmundi"> <sub><b>spmundi</b></sub></a> <a href="#ideas-spmundi" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/koernepr"> <sub><b>Peter Körner</b></sub></a> <a href="#security-koernepr" title="Security">🛡️</a></td> <td align="center"><a href="https://github.com/rubyFeedback"> <sub><b>rubyFeedback</b></sub></a> <a href="#ideas-rubyFeedback" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/rbolsius"> <sub><b>rbolsius</b></sub></a> <a href="#platform-rbolsius" title="Packaging/porting to new platform">📦</a></td> </tr> <tr> <td align="center"><a href="https://github.com/awildturtok"> <sub><b>awildturtok</b></sub></a> <a href="#ideas-awildturtok" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/agguser"> <sub><b>agguser</b></sub></a> <a href="#ideas-agguser" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/jganong"> <sub><b>jganong</b></sub></a> <a href="#ideas-jganong" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://www.linkedin.com/in/fulvio-scapin"> <sub><b>Fulvio Scapin</b></sub></a> <a href="#ideas-trantor" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/torbiak"> <sub><b>Jordan Torbiak</b></sub></a> <a href="#ideas-torbiak" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/Andy1978"> <sub><b>Andreas Weber</b></sub></a> <a href="#ideas-Andy1978" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/vapniks"> <sub><b>vapniks</b></sub></a> <a href="#platform-vapniks" title="Packaging/porting to new platform">📦</a></td> </tr> <tr> <td align="center"><a href="https://github.com/89z"> <sub><b>Zombo</b></sub></a> <a href="#platform-89z" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://github.com/BEFH"> <sub><b>Brian Fulton-Howard</b></sub></a> <a href="#platform-BEFH" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://github.com/ChCyrill"> <sub><b>ChCyrill</b></sub></a> <a href="#ideas-ChCyrill" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/jauderho"> <sub><b>Jauder Ho</b></sub></a> <a href="https://github.com/johnkerl/miller/commits?author=jauderho" title="Code">💻</a></td> <td align="center"><a href="https://github.com/psacawa"> <sub><b>Paweł Sacawa</b></sub></a> <a href="https://github.com/johnkerl/miller/issues?q=author%3Apsacawa" title="Bug reports">🐛</a></td> <td align="center"><a href="https://github.com/schragge"> <sub><b>schragge</b></sub></a> <a href="https://github.com/johnkerl/miller/commits?author=schragge" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/Poshi"> <sub><b>Jordi</b></sub></a> <a href="https://github.com/johnkerl/miller/commits?author=Poshi" title="Documentation">📖</a> <a href="#ideas-Poshi" title="Ideas, Planning, & Feedback">🤔</a></td> </tr> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END --> <a href="https://github.com/johnkerl/miller/graphs/contributors"> </a>This project follows the all-contributors specification. Contributions of any kind are welcome!