Install xan CSV Processing Tool on Ubuntu 24.04

Install xan CSV Processing Tool on Ubuntu 24.04

The xan is a command line tool for processing CSV files. The tool offers a comprehensive set of operations for various CSV manipulations, including previewing, filtering, slicing, aggregating, sorting, and joining files. This tutorial shows how to install xan on Ubuntu 24.04.

Install xan

Retrieve the latest version tag of the Xan release from GitHub and assign it to a variable:

XAN_VERSION=$(curl -s "https://api.github.com/repos/medialab/xan/releases/latest" | grep -Po '"tag_name": "\K[0-9.]+')

Download tar.gz file from releases page:

wget -qO xan.tar.gz https://github.com/medialab/xan/releases/latest/download/xan_${XAN_VERSION}_x86_64-unknown-linux-musl.tar.gz

Extract executable from archive to /usr/local/bin directory:

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

We can check xan version as follows:

xan --version

We can delete the unnecessary tar.gz file:

rm -rf xan.tar.gz

Testing xan

Create simple CSV file for testing:

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

The xan supports various operations. For example, we can use the view argument to display CSV data in the table:

xan view test.csv

Output:

Displaying 2 cols from 4 rows of test.csv
┌───┬────────┬─────┐
│ - │ name   │ age │
├───┼────────┼─────┤
│ 0 │ John   │ 25  │
│ 1 │ James  │ 29  │
│ 2 │ Oliver │ 35  │
│ 3 │ Emma   │ 31  │
└───┴────────┴─────┘

Uninstall xan

If you want to completely remove xan, delete the related file:

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

Leave a Comment

Cancel reply

Your email address will not be published.