August 22, 2025

Using Miller command-line tool to query .csv files in the terminal

I found out about Miller a few days ago.

to download Miller on GNU/Linux:

$ sudo apt install miller

I have been using it to preview and sort .csv files instead of using Visidata or Libreoffice. Then, I’ve used the command substitute in Vim, say, to remove trailing white space.

The command I use to preview a file with Miller is:

$ mlr --icsv --opprint head example.csv

Essentially, I understand that the flag icsv tells Miller that the input data is a .csv file, and the flag opprint calls pretty-printed tabular — try without, the outpout will be a lot less readable.

I’ve also used Miller to sort and display data, for exmaple:

$ mlr --icsv --opprint sort -f2 company example.csv

to sort companies, if the second field of the file example.csv lists company’s names.

And along with Miller, I’ve also used coreutils, for example to count the number of entry for a specific field:

$ cut -d ',' -f5 example.csv | sort | uniq | wc

More: https://miller.readthedocs.io/en/latest/10min/


personal computing command-line interface (cli) gnu linux trisquel shell literacy miller wiki offline office applications

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2025 by yctct is licensed under CC BY-SA 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88