SkillsApr 13, 2026·3 min read

xsv — Fast CSV Toolkit Written in Rust

xsv is a blazing-fast command-line toolkit for working with CSV data. It provides indexing, slicing, searching, joining, aggregation, and statistics — processing millions of rows per second for data analysis, ETL pipelines, and CSV manipulation.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
step-1.md
Direct install command
npx -y tokrepo@latest install 82f0e8a4-3745-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

TL;DR
xsv processes CSV data at millions of rows per second with indexing, slicing, searching, joining, aggregation, and statistics from the command line.
§01

What it is

xsv is a command-line toolkit for working with CSV data, written in Rust. It provides a suite of subcommands for viewing headers, slicing rows, selecting columns, searching with regex, joining files, computing statistics, and reformatting output. Rust compilation gives xsv the ability to process millions of rows per second on commodity hardware.

xsv targets data engineers, analysts, and developers who work with CSV files in the terminal. It fills the gap between simple tools like cut and awk (which do not understand CSV quoting) and full data processing frameworks (which require writing programs).

§02

How it saves time or tokens

xsv operates on CSV data natively, handling quoted fields, escaped commas, and multi-line values correctly. A single xsv command replaces multi-step awk/sed pipelines. The index subcommand creates a binary index for instant random access into large files. Statistics computation runs in streaming mode without loading the entire file into memory.

§03

How to use

  1. Install xsv via brew install xsv on macOS or cargo install xsv from source.
  2. Explore CSV structure with xsv headers data.csv and xsv stats data.csv.
  3. Chain subcommands with pipes: select, filter, sort, and aggregate in a single pipeline.
§04

Example

# View CSV headers
xsv headers data.csv

# First 10 rows, pretty-printed
xsv slice -l 10 data.csv | xsv table

# Select specific columns
xsv select name,email,age data.csv

# Search rows by regex
xsv search -s status 'active' data.csv

# Statistics for all columns
xsv stats data.csv | xsv table

# Join two CSV files on a common column
xsv join id users.csv user_id orders.csv

# Count rows by category
xsv frequency -s category data.csv
§05

Related on TokRepo

§06

Common pitfalls

  • xsv is CSV-only. It does not support JSON, TSV with tab delimiters (use --delimiter flag), or other formats. For multi-format needs, consider Miller.
  • The xsv project has not received major updates recently. For active development, check out qsv, a maintained fork with additional features.
  • Large file joins load the smaller file into memory. Ensure adequate RAM when joining against files with millions of rows.

Frequently Asked Questions

How fast is xsv compared to awk for CSV processing?+

xsv is significantly faster than awk for CSV-specific operations because it uses Rust's zero-cost abstractions and handles CSV parsing natively. For simple field extraction, xsv processes millions of rows per second. awk is faster for unstructured text but does not understand CSV quoting.

Does xsv handle quoted CSV fields correctly?+

Yes. xsv fully supports RFC 4180 CSV, including quoted fields with commas, escaped quotes, and multi-line values. This is a key advantage over awk and cut, which treat commas as simple delimiters.

What is qsv and how does it relate to xsv?+

qsv is an actively maintained fork of xsv with additional features including JSON output, Python scripting support, and more subcommands. If you need features beyond what xsv offers, qsv is the recommended alternative.

Can xsv process files larger than RAM?+

xsv processes most operations in streaming mode without loading the entire file. Statistics, searching, and slicing work on arbitrarily large files. Join operations load the smaller file into memory, which may be a limitation.

Does xsv support piping with other Unix tools?+

Yes. xsv reads from stdin and writes to stdout, making it fully compatible with Unix pipes. You can chain xsv commands or mix them with grep, sort, head, and other standard tools.

Citations (3)
  • xsv GitHub— xsv provides indexing, slicing, searching, joining, and statistics for CSV data
  • xsv README— Rust-based CSV processing with RFC 4180 compliance
  • Rust csv crate— CSV data processing patterns and command-line tooling

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets