csv2tsv
Convert CSV files to TSV files
TLDR
Convert from CSV to TSV
Convert field delimiter separated CSV to TSV
Convert semicolon separated CSV to TSV
SYNOPSIS
csv2tsv [options] [FILE]
PARAMETERS
-d DELIM, --delimiter DELIM
Input field delimiter (default: ,)
-q QUOTECHAR, --quotechar QUOTECHAR
Character to quote fields (default: ")
-u FIELD, --uppercasenull FIELD
Uppercase NULL values in specified field(s)
-z FIELD, --lowercasenull FIELD
Lowercase NULL values in specified field(s)
-b, --blanks
Treat blank lines as empty strings, not NULL
-H, --no-header-row
Ignore first row as header
--help
Display help and exit
--version
Show version and exit
DESCRIPTION
csv2tsv is a utility from the csvkit suite that transforms comma-separated value (CSV) files into tab-separated value (TSV) files.
It reads CSV data from a file or standard input, correctly parsing quoted fields, escaped characters, and delimiters to maintain data integrity. Output is always tab-delimited, with fields quoted only when necessary (e.g., containing tabs, newlines, or quotes).
This tool excels in Unix pipelines, where TSV integrates seamlessly with commands like cut, paste, or awk. Unlike crude text substitutions, csv2tsv understands CSV standards (RFC 4180-ish), handling complex cases without corruption.
Customization options allow tweaking input parsing for non-standard CSVs, managing NULL representations, and skipping headers. Ideal for data migration, ETL processes, or preparing files for spreadsheet imports favoring tabs.
CAVEATS
Requires csvkit installation (not core Linux). Outputs to stdout only; redirect with >. Assumes UTF-8; large files may need memory tweaks.
INSTALLATION
pip install csvkit or sudo apt install csvkit.
EXAMPLE
csv2tsv data.csv > data.tsv
Converts data.csv to tab-separated data.tsv.
HISTORY
Introduced in csvkit 0.1 (2010) by Christopher Groskopf; evolved with Python agate engine for robust parsing. Maintained on GitHub, used in data journalism and analytics.


