Install xsv on Ubuntu 20.04

The xsv is a command line based CSV processor which allows to search, slice, split, join, sort, or perform other operations on CSV data.

This tutorial shows how to install xsv on Ubuntu 20.04.

Install xsv

Get the latest version tag of xsv release from GitHub and assign version tag to variable.

XSV_VERSION=$(curl -s "" | grep -Po '"tag_name": "\K[0-9.]+')

Download tar.gz file from releases page of the xsv repository:

curl -Lo xsv.tar.gz "${XSV_VERSION}-x86_64-unknown-linux-musl.tar.gz"

Extract a tar.gz file to /usr/local/bin directory.

sudo tar xf xsv.tar.gz -C /usr/local/bin

Now xsv can be used for all users as system-wide command.

We can check xsv version:

xsv --version

We can remove unnecessary tar.gz file:

rm -rf xsv.tar.gz

Testing xsv

Create simple CSV file:

echo -e 'name,age\nJohn,25\nJames,29\nOliver,35\nEmma,31' > test.csv

The xsv supports various operations. For example, we can use table argument to display aligned output of CSV data:

xsv table test.csv


name    age
John    25
James   29
Oliver  35
Emma    31

The count argument allows to count the rows in a CSV file.

xsv count test.csv



We can search the rows for particular field using regular expression. For example, the following command finds all rows in a CSV file where name field starts with letter J.

xsv search -s name '^J' test.csv

You will get the following output:


Testing xsv

If you decided to completely remove xsv, delete related file:

sudo rm -rf /usr/local/bin/xsv

This article has 1 comment

Leave a Comment

Your email address will not be published. Required fields are marked *