# xan

> Rust command line tool for processing large CSV files: preview, filter, sort, join, aggregate, and plot, with its own expression language and multithreading.

Stars: 4.6k · Language: Rust · License: Unlicense · Categories: Data

- Repository: https://github.com/medialab/xan
- Page: https://www.trmn.sh/tools/xan

## Install

- Homebrew: `brew install xan`
- Cargo: `cargo install xan --locked`
- Pacman: `sudo pacman -S xan`

## Overview

xan is a command line tool for processing CSV files from the shell. It is written in Rust and uses a SIMD CSV parser (simd-csv). Some computations can be parallelized across threads. It started as a fork of BurntSushi's xsv and has since been almost entirely rewritten for the use cases of SciencesPo's médialab.

It provides a large set of composable commands that can be chained in pipelines to preview, filter, slice, aggregate, sort and join tabular data. Examples from the quick tour include `xan headers`, `xan count`, `xan view` (a table preview in the terminal, with a `-p` pager flag on unix), `xan flatten` (a row-by-row view of fields) and `xan search -s outreach internationale medias.csv | xan view`. For tasks the simple commands can't cover, xan has its own minimalistic expression language tailored to CSV data.

Beyond core tabular operations, xan includes utilities for lexicometry, graph theory and scraping. It can also draw terminal visualisations: histograms, scatterplots, time series, small multiples, correlation matrices and heatmaps. It reads CSV-adjacent formats such as web archive `.cdx` and bioinformatics formats (`.vcf`, `.gtf`, `.sam`, `.bed`). `xan from` and `xan to` convert to and from JSON, NDJSON, Excel and numpy arrays. It can also use parquet files, and it supports compressed files and shell completions for commands and column names (`xan completions`). It suits data analysts, researchers and developers who work with large CSV files in the terminal.

### Installation

```bash
# via Homebrew
brew install xan
```

```bash
# via Cargo
cargo install xan --locked
```

```bash
# via Pacman
sudo pacman -S xan
```

## Alternatives

- [qsv](https://www.trmn.sh/tools/qsv.md): Rust CLI toolkit of composable commands for querying, transforming, validating, joining, and describing CSV, Excel, and other tabular data. (Rust, 3.8k stars)
- [angle-grinder](https://www.trmn.sh/tools/angle-grinder.md): Command-line log analysis tool that parses, filters, and aggregates log data with a pipeline query language and a live-updating terminal UI. (Rust, 3.8k stars)
- [rainfrog](https://www.trmn.sh/tools/rainfrog.md): Terminal database client with vim-like keybindings and a query editor, supporting Postgres, MySQL, SQLite, Redshift, DuckDB, and Oracle. (Rust, 5.4k stars)
- [jless](https://www.trmn.sh/tools/jless.md): Command-line JSON viewer with syntax highlighting, collapsible sections, and vim-inspired navigation commands (Rust, 5.5k stars)
- [jnv](https://www.trmn.sh/tools/jnv.md): Interactive terminal JSON viewer and jq filter editor with auto-completion, using the built-in jaq engine; reads files or stdin. (Rust, 6.1k stars)

---

Canonical: https://www.trmn.sh/tools/xan
