HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
BurntSushi
xsv
Rust2015–2026
BurntSushi / xsv · Archived

xsv

A fast CSV command line toolkit written in Rust.

76Distinct people
103Mentions
4Explicit recommenders
10.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A fast CSV command line toolkit written in Rust.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

Yesss. Glad to see this getting some love. I use this tool very frequently in my day-to-day and my work would be so much harder without it. A lot of folks mentioning great…

nkcmr used a recommendation phrase. 4 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 4:43:50 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year103 dated mentions

Observed mentions: 2015-02-22 09:10:33 UTC to 2026-01-19 06:08:33 UTC.

051015202015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 14 mentions; 1 submissions, 13 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 18 mentions; 0 submissions, 18 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 9 mentions; 2 submissions, 7 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 12 mentions; 1 submissions, 11 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 13 mentions; 0 submissions, 13 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC615
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC514
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC615
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC14113
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC18018
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC10010
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC927
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC12111
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC13013
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC707
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
xsv is now unmaintained In lieu of xsv, I'd recommend either qsv or xan. xsv is a command line program for indexing, slicing, analyzing, splitting and joining CSV files. Commands should be simple, fast and composable: Simple tasks should be easy. Performance trade offs should be exposed in the CLI interface. Composition should not come at the expense of performance. This README contains information on how to install xsv, in addition to a quick tour of several commands. Dual-licensed under MIT or the UNLICENSE. Available commands cat - Concatenate CSV files by row or by column. count - Count the rows in a CSV file. (Instantaneous with an index.) fixlengths - Force a CSV file to have same-length records by either padding or truncating them. flatten - A flattened view of CSV records. Useful for viewing one record at a time. e.g., xsv slice -i 5 data.csv | xsv flatten. fmt - Reformat CSV data with different delimiters, record terminators or quoting rules. (Supports ASCII delimited data.) frequency - Build frequency tables of each column in CSV data. (Uses parallelism to go faster if an index is present.) headers - Show the headers of CSV data. Or show the intersection of all headers between many CSV files. index - Create an index for a CSV file. This is very quick and provides constant time indexing into the CSV file. input - Read CSV data with exotic quoting/escaping rules. join - Inner, outer and cross joins. Uses a simple hash index to make it fast. partition - Partition CSV data based on a column value. sample - Randomly draw rows from CSV data using reservoir sampling (i.e., use memory proportional to the size of the sample). reverse - Reverse order of rows in CSV data. search - Run a regex over CSV data. Applies the regex to each field individually and shows only matching rows. select - Select or re-order columns from CSV data. slice - Slice rows from any part of a CSV file. When an index is present, this only has to parse the rows in the slice (instead of all rows leading up to the start of the slice). sort - Sort CSV data. split - Split one CSV file into many CSV files of N chunks. stats - Show basic types and statistics of each column in the CSV file. (i.e., mean, standard deviation, median, range, etc.) table - Show aligned output of any CSV data using elastic tabstops. A whirlwind tour Let's say you're playing with some of the data from the Data Science Toolkit, which contains several CSV files. Maybe you're interested in the population counts of each city in the world. So grab the data and start examining it: $ curl -LO https://burntsushi.net/stuff/worldcitiespop.csv $ xsv headers worldcitiespop.csv 1 Country 2 City 3 AccentCity 4 Region 5 Population 6 Latitude 7 Longitude The next thing you might want to do is get an overview of the kind of data that appears in each column. The stats command will do this for you: $ xsv stats worldcitiespop.csv --everything | xsv table field type min max min_length max_length mean stddev median mode cardinality Country Unicode ad zw 2 2 cn 234 City Unicode bab el ahmar Þykkvibaer 1 91 san jose 2351892 AccentCity Unicode Bâb el Ahmar ïn Bou Chella 1 91 San Antonio 2375760 Region Unicode 00 Z9 0 2 13 04 397 Population Integer 7 31480498 0 8 47719.570634 302885.559204 10779 28754 Latitude Float -54.933333 82.483333 1 12 27.188166 21.952614 32.497222 51.15 1038349 Longitude Float -179.983333 180 1 14 37.08886 63.22301 35.28 23.8 1167162 The xsv table command takes any CSV data and formats it into aligned columns using elastic tabstops. You'll notice that it even gets alignment right with respect to Unicode characters. So, this command takes about 12 seconds to run on my machine, but we can speed it up by creating an index and re-running the command: $ xsv index worldcitiespop.csv $ xsv stats worldcitiespop.csv --everything | xsv table ... Which cuts it down to about 8 seconds on my machine. (And creating the index takes less than 2 seconds.) Notably, the same type of "statistics" command in another CSV command line toolkit takes about 2 minutes to produce similar statistics on the same data set. Creating an index gives us more than just faster statistics gathering. It also makes slice operations extremely fast because only the sliced portion has to be parsed. For example, let's say you wanted to grab the last 10 records: $ xsv count worldcitiespop.csv 3173958 $ xsv slice worldcitiespop.csv -s 3173948 | xsv table Country City AccentCity Region Population Latitude Longitude zw zibalonkwe Zibalonkwe 06 -19.8333333 27.4666667 zw zibunkululu Zibunkululu 06 -19.6666667 27.6166667 zw ziga Ziga 06 -19.2166667 27.4833333 zw zikamanas village Zikamanas Village 00 -18.2166667 27.95 zw zimbabwe Zimbabwe 07 -20.2666667 30.9166667 zw zimre park Zimre Park 04 -17.8661111 31.2136111 zw ziyakamanas Ziyakamanas 00 -18.2166667 27.95 zw zizalisari Zizalisari 04 -17.7588889 31.0105556 zw zuzumba Zuzumba 06 -20.0333333 27.9333333 zw zvishavane Zvishavane 07 79876 -20.3
Read the full README on GitHub

What Hacker News says

14 sources
CSV is just a serialisation format like JSON or XML. CST appears to put the emphasis on readability (not a bad thing!). I've taken to using XSV to pretty-print CSV data in bug reports or feature requests for coworkers who give me CSV or spreadsheets to work with. The data doesn't need to go any further, it's already been processed, it just needs to be clearer to understand than raw CSV/JSON/XML: https://github.com/BurntSushi/xsv (link has examples of pretty-printed CSV)
In Comma-Separated Tree
It is decidedly not a language to get things done. I say this as someone who put himself in the unfortunate position of challenging BurntSushi (author of ripgrep) to a coding duel, bragging that I could get LuaJIT to match his XSV performance (https://github.com/BurntSushi/xsv) It took hours to figure out how to implement this in rust: https://github.com/sctb/lumen/blob/master/bin/lumen If you want to see an "expert" programmer's attempt at making sense of the language, here you go: https://gist.github.com/shawwn/4d7a89188cac72f3e591f47c84d3c... Now that it's done though, I see why people fall in love with Rust. It's really satisfying seeing Lumen's startup time drop from 200ms to 100ms. But yes, like -- dude, at one point I just wanted to write a for loop like this, to grab some environment vars: let mut lumen_host = "luajit"; l
Read the rest
et mut lua_path = ""; let mut node_path = ""; for (name, value) in env::vars() { if name == "LUMEN_HOST" { lumen_host = &value; } else if name == "LUA_PATH" { lua_path = &value; } else if name == "NODE_PATH" { node_path = &value; } } println!("{} {} {} {}", bin, lumen_host, lua_path, node_path); Good luck with that! I'm sure there's a way to coax Rust into please-allow-me-to-just-compile-this, but the borrow checker is a cruel taskmaster. Whatever the syntax is, that's not it, and spending literally an hour trying to figure out how to store an environment variable into a separate variable doesn't feel very productive. That said, Cargo is amazing. It's truly a wonderful, delightful piece of software. Cargo crates plus a dynamic language seems like a recipe for success.
In Why Rust closures are somewhat hard
The LuaJIT idea is interesting, I've certainly been impressed by it in the past, and can agree it is to some extent something that dispels myths like "statically typed languages are always faster than unityped languages." But if you instead interpret that as a first approximation, then it's fairly accurate IMO. In the interest of cutting to the chase, I'll try to explain some of the high level ideas of why the CSV parser is fast, and typically faster than any other CSV parser I've come across. Firstly, it is implemented by a hand-rolled DFA that is built from an NFA. The NFA is typically what most robust CSV parsers use, and it is quite fast, but it suffers from the overhead of moving through epsilon transitions and handling case analysis that is part of the configuration of the parser (i.e., delimiter, quote, escaping rules, etc.). It se
Read the rest
ems to me like this concept could be carried over to LuaJIT. Secondly, the per-byte overhead of the DFA is very low, and even special cases[1] some transitions to get the overhead even lower. If you were doing this in pure Python or Lua or really any unityped language, I would be very skeptical that you could achieve this because of all the implicit boxing that tends to go on in those languages. Now, if you toss a JIT in the mix, I kind of throw my hands up. Maybe it will be good enough to cut through the boxing that would otherwise take place. From what I've heard about Mike Pall, it wouldn't surprise me! If the JIT fails at this, I'm not sure how I'd begin debugging it. I kind of imagine it's like trying to convince a compiler to optimize a segment of code in a certain way, but only harder. Thirdly, a critical aspect of keeping things fast that bubbles all the way up into the xsv application code itself is the amortization of allocation. Namely, when xsv iterates over a CSV file, it reuses the same memory allocation for each record[2]. If you've written performance sensitive code before, then this is amateur hour, but I personally have always struggled to get these kinds of optimizations in unityped languages because allocation is typically not a thing they optimize for. Can a JIT cut through this? I don't know. I'm out of my depth. But I can tell you one thing for sure: in languages like Rust, C or C++, amortizing allocation is a very common thing to do. It is straight-forward and never relies on the optimizer doing it for you. There are some different angles to take here though. For example, unityped languages tend to be garbage collected, and in that environment, allocations can be faster which might make amortization less effective. But I'm really waving my hands here. I'm just vaguely drawing on experience. Anyway, I think it's kind of counter productive to try to play the "knows better than the hivemind" role here. There are really good solid reasons why statically typed languages tend to out-perform unityped languages, and just because there is a counter example in some cases doesn't make those reasons any less important. I think I could also construct an argument around how statically typed languages make it easier to reason about performance, but I don't quite know how to phrase it. In particular, at the end of the day, both cases wind up relying on some magic black box (a compiler's optimizer or a JIT), but I'm finding it difficult to articulate why that isn't the full story. [1] - https://github.com/BurntSushi/rust-csv/blob/546291a0095a2537... [2] - https://github.com/BurntSushi/xsv/blob/9574d89634031259802dd...
In XSV: A fast CSV command-line toolkit written in Rust

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.