xsv CSV data command line examples handy xsv examples

10 Handy Examples of Working with CSV Data from the Command Line Using xsv

Introducing useful examples and usage of the CLI tool 'xsv' that can be used on Linux PC/server Bash command line, which can be utilized for daily work efficiency, business efficiency improvement, and programming.

Shou Arisaka
2 min read
Nov 20, 2025

Introducing useful examples and usage of the CLI tool “xsv” that can be used on Linux PC/server Bash command line, which can be utilized for daily work efficiency, business efficiency improvement, and programming.

Image

I tried using xsv, which is optimal for handling CSV data from the bash command line.

BurntSushi/xsv: A fast CSV command line toolkit written in Rust.

Installation

Installation with Rust’s package management system cargo is easy.

cargo install xsv
# export PATH="$PATH:${HOME}/.cargo/bin"

Check Reference

xsv --help
xsv select --help
xsv sort --help
# and more 

Filter by Columns, Sort, and Format CSV

xsv select 1,5,4,3 | xsv table

Sort by Specific Column in Numerical Order ( -R … —reverse )

xsv sort --select Rating -N -R

Change Delimiter; Read TSV

xsv select AnimeName-Rating -d "\t" anime_database.csv 

Receive Data from Standard Input Instead of File

xsv select AnimeName-Rating -d "\t" - <<< "$( data-anime-csv )" 

Filter Specific Column with Regular Expression

xsv search --select title ".*"

Filter Specific Column with Regular Expression ( Example: Output Only Numeric Rating 8, 9, 10 )

xsv search --select Rating "^[8-9]|1[0]$"

Filter Specific Column with Regular Expression ( Negation )

xsv search --select Status --invert-match '^(Stopped)

Convert TSV to CSV

xsv fmt -d "\t" -t ","

Convert TSV to CSV ( Quote )

xsv fmt -d "\t" --quote-always -t ","

Share this article

Shou Arisaka Nov 20, 2025

🔗 Copy Links