# xsv

> Command line CSV data manipulation tool for indexing, slicing, analyzing, splitting and joining CSV files

Stars: 10.8k · Language: Rust · License: MIT · Categories: Data · Status: archived

- Repository: https://github.com/BurntSushi/xsv
- Page: https://www.trmn.sh/tools/xsv
- Demo video: https://media.trmn.sh/demos/346d55461f5e5f370fd9c48b6513e26b0fc3da5338ec0a56abc2a372219b6652.mp4

## Overview

xsv is a command line program for processing CSV files with operations including indexing, slicing, analyzing, splitting, and joining. The tool provides 20+ commands that can be chained together, including count, stats, search, select, sort, join, and frequency analysis. Commands are designed to be simple, fast, and composable.

The tool supports creating indexes for CSV files that enable constant-time slicing operations and significantly faster statistics gathering. For example, with an index, you can instantly extract the last 10 records from a 3+ million row dataset without parsing the entire file. Performance is a key focus - xsv can generate statistics on large datasets significantly faster than comparable tools.

xsv includes specialized commands like frequency table generation, reservoir sampling for random row selection, regex search across fields, and various join operations (inner, outer, cross) using hash indexes. The stats command provides comprehensive column analysis including data types, ranges, means, standard deviations, and cardinality counts. Output formatting is handled by the table command which uses elastic tabstops for proper alignment.

Note: The original xsv project is now unmaintained, with the author recommending qsv or xan as alternatives. This tool would primarily be used by data analysts, researchers, and developers who need to process large CSV datasets from the command line.

## Alternatives

- [htmlq](https://www.trmn.sh/tools/htmlq.md): HTML parser that uses CSS selectors to extract content from HTML files, similar to jq for JSON (Rust, 7.6k 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)
- [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)
- [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)

## Guides

- [Best CSV Tools for the Command Line](https://www.trmn.sh/best/csv-tools): Compare Miller, VisiData, xsv, qo and csvlens for querying, transforming and browsing CSV files from the terminal.

---

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