Install
# Check if it is installed csvtool --help # RHEL / Alma / Rocky sudo dnf install csvtool # Debian / Ubuntu sudo apt install csvtool # openSUSE sudo zypper install csvtool # Arch # Usually not in the base repos; check AUR or use csvkit / miller instead
What it does
csvtool is a command-line utility for working with comma-separated value files. It understands CSV structure better than plain text tools, so it is safer than using cut or awk on files that may contain quoted fields, commas inside data, or header rows.
How it works (mechanical)
- Reads CSV input from a file or standard input.
- Parses rows and fields using CSV rules rather than plain character splitting.
- Applies a subcommand such as cut, sort, transpose, or named-column selection.
- Writes the transformed CSV or formatted output to standard output.
- Works best when the input is true CSV and not loosely comma-like text.
Quick Start
# Show a CSV file csvtool readable sample.csv # Cut selected columns csvtool col 1,3 sample.csv # Sort by a column csvtool sort -r 2 sample.csv
10 Practical Examples
- Print a CSV in a friendlier layout
csvtool readable inventory.csv
- Extract selected columns
csvtool col 1,4,5 sales.csv
- Skip the header, then inspect data
tail -n +2 sales.csv | csvtool readable -
- Sort rows by the second column
csvtool sort 2 employees.csv
- Sort in reverse order
csvtool sort -r 3 scores.csv
- Transpose rows and columns
csvtool transpose matrix.csv
- Count rows quickly
csvtool height data.csv
- Work from a pipeline
curl -s https://example.com/report.csv | csvtool readable -
- Select named columns when supported by local version
csvtool namedcol Name,Email clients.csv
- Combine with column for terminal display
csvtool readable team.csv | column -t -s ','
Notes & Gotchas
- Versions differ. Some builds support more subcommands than others, so check
csvtool --helplocally. - Safer than plain text splitting. CSV quoting rules matter, especially when commas appear inside fields.
- Header handling varies by subcommand. Some actions treat the header like ordinary data unless you manage it explicitly.
- Not always preinstalled. On some systems, Miller or csvkit may be easier to get.
- Good for quick work, not full data science. For larger workflows, dedicated tools may be more flexible.
Historical Context
csvtool grew out of the need to manipulate spreadsheet-style data safely from scripts without writing custom parsers. It remains useful for shell-driven reporting, system exports, mailing lists, and quick inspection of structured tabular files.
Modern Equivalent
mlr— Miller is often more powerful and flexible for CSV/TSV processingcsvkit— a rich suite of CSV tools with strong inspection and SQL-like helperspython -c 'import csv'— useful when custom logic is needed
Related Commands
- column — make tabular output easier to read in a terminal
- datamash — summarize and group tabular text
- awk — general field processing for structured text
- cut — simple field extraction for delimiter-separated data
- sort — order lines before or after CSV extraction
- comm — compare sorted file outputs
- shuf — randomize rows for sampling
- nl — number output rows for inspection