LinuxCommandLibrary

csvformat

CSV format and delimiter converter

TLDR

Convert CSV to tab-delimited

$ csvformat -T [input.csv]
copy
Change delimiter
$ csvformat -D "[;]" [input.csv]
copy
Convert to specific quoting
$ csvformat -U [0|1|2|3] [input.csv]
copy
Remove header
$ csvformat -K [1] [input.csv]
copy

SYNOPSIS

csvformat [options] [file]

DESCRIPTION

csvformat is part of csvkit that converts CSV files between different delimited formats. It allows changing field delimiters, quote characters, quoting styles, and line terminators while maintaining proper CSV structure.
The tool is useful for converting CSV files to tab-delimited format for Unix tools, standardizing quote handling across files, or reformatting data for systems with specific delimiter requirements. It properly handles CSV quoting rules during conversion.
Quoting styles include minimal (quote only when necessary), all fields, non-numeric fields only, and none. The tool can also skip header rows and adjust line endings for cross-platform compatibility.

PARAMETERS

-T

Output tab-delimited.
-D delimiter
Set output delimiter.
-U style
Quoting style: 0=minimal, 1=all, 2=non-numeric, 3=none.
-K n
Skip first n rows.
-M char
Set output line terminator.
-d CHAR, --delimiter CHAR
Input field delimiter (default: comma).
-e ENCODING, --encoding ENCODING
Input file encoding.

CAVEATS

Part of csvkit, requires Python. Type inference determines quoting behavior in minimal mode. Some combinations of options may produce invalid CSV for certain parsers.

HISTORY

csvformat is part of csvkit, created by Christopher Groskopf in 2011. It addresses the common need to convert between CSV dialects and delimited formats while preserving data integrity.

SEE ALSO

csvkit(1), csv-diff(1), csvlook(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community