<h1 align="center">Fastmash</h1>
<p align="center">
<strong>Fast command-line statistics for delimited text.</strong><br>
A Rust implementation of the GNU datamash command language.
</p>
<p align="center">
<a href="https://github.com/pederbe/fastmash/actions/workflows/ci.yml?query=event%3Apull_request"><img alt="Pull request CI" src="https://github.com/pederbe/fastmash/actions/workflows/ci.yml/badge.svg?event=pull_request"></a>
<a href="https://github.com/pederbe/fastmash/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/pederbe/fastmash"></a>
<a href="https://github.com/pederbe/fastmash/blob/main/LICENSE-MIT"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue"></a>
or
<a href="https://github.com/pederbe/fastmash/blob/main/LICENSE-APACHE"><img alt="Apache 2.0 license" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
</p>
<p align="center">
<a href="https://fastmash.io">Documentation</a> ·
<a href="https://fastmash.io/install.html">Install</a> ·
<a href="https://fastmash.io/benchmarks/">Benchmarks</a> ·
<a href="https://fastmash.io/guide/migrating.html">Migrating from datamash</a>
</p>
---
Fastmash summarizes and groups delimited text and quoted CSV from the command
line. It also reshapes ordinary delimited text. It accepts the command language of
[GNU datamash](https://www.gnu.org/software/datamash/), so most existing scripts can
switch by changing one word.
```console
$ printf 'site\treading\nwest\t2\neast\t4\nwest\t6\n' | fastmash -H -s -g site sum reading mean reading
Grouped summary
────────────────────────────────
site sum(reading) mean(reading)
east 4 4
west 8 4
✔ Completed
```
## Why Fastmash
- **Speed.** About five times faster than GNU datamash on RefGene quartiles in
[published Linux benchmarks](https://fastmash.io/benchmarks/).
- **Familiar commands.** Over 70 operations and modes, with grouping, headers,
field selectors, percentiles, `crosstab` and `transpose`.
- **CSV and table tools.** Read and write quoted CSV, name result columns,
calculate weighted means, select top records, compare datasets and check
table health.
- **Repeatable results.** Software arithmetic gives identical numerical results
across supported machines for the same input, settings and Fastmash version.
## Install
Fastmash runs on **Linux**, **macOS 15 and later**, and **Windows 11**.
[Native Windows installation](https://fastmash.io/install.html#on-windows) uses
PowerShell 7.4+.
Install prebuilt programs with your package manager. On Debian or Ubuntu,
add the [signed apt repository](https://fastmash.io/install.html#debian-and-ubuntu).
On Fedora, RHEL and similar systems:
```sh
sudo curl -fsSLo /etc/yum.repos.d/fastmash.repo https://packages.fastmash.io/fastmash.repo
sudo dnf install fastmash
```
With Homebrew on macOS or Linux:
```sh
brew install pederbe/tap/fastmash
```
On Linux, macOS or inside WSL2, the quick installer downloads the latest release:
```sh
The [installation guide](https://fastmash.io/install.html) also covers single
packages, release archives, cargo-binstall and compiling with Cargo.
## Quick start
```sh
# Sum CSV revenue by region and name the result column
printf 'region,revenue\nwest,20\neast,12\nwest,15\n' | fastmash --csv -H -s -g region --result-name=1:total sum revenue
# Weight prices by the number of units
printf 'price\tunits\n10\t2\n5\t3\n' | fastmash -H wmean price:units
# Keep the two records with the highest revenue
printf 'item,revenue\na,10\nb,30\nc,20\n' | fastmash --csv -H top:2 revenue
```
These examples use Bash. See the [PowerShell quick start](https://fastmash.io/quick-start.html#powershell-74)
for Windows file input and pipelines. Use `--csv` for quoted CSV and `-H` to select fields by header name.
The [user guide](https://fastmash.io/guide/) covers all operations and options,
with complete examples for [table validation](https://fastmash.io/guide/table-health.html)
and [before-and-after reports](https://fastmash.io/guide/dataset-comparison.html).
## Compatibility
Fastmash implements the GNU datamash 1.9 command language. See the
[migration guide](https://fastmash.io/guide/migrating.html) to switch existing
scripts and the [documented differences](https://fastmash.io/guide/differences.html)
for compatibility details.
## Documentation
- [User guide](https://fastmash.io/guide/) for commands and examples
- [Architecture](https://github.com/pederbe/fastmash/blob/main/ARCHITECTURE.md) for how Fastmash is built
- [Changelog](https://github.com/pederbe/fastmash/blob/main/CHANGELOG.md) for changes between releases
## Contributing
Found a bug or have a workload to share?
[Open an issue](https://github.com/pederbe/fastmash/issues/new/choose) or read the
[contributing guide](https://github.com/pederbe/fastmash/blob/main/CONTRIBUTING.md).
Report vulnerabilities through the
[security policy](https://github.com/pederbe/fastmash/blob/main/SECURITY.md).
---
<p align="center">Created by <a href="https://pederbe.dev">Peder Bergan</a></p>