fmt

May 31, 2026 · View on GitHub

Reformat a CSV with different delimiters, record terminators or quoting rules. (Supports ASCII delimited data.)

Table of Contents | Source: src/cmd/fmt.rs

Description | Usage | Fmt Options | Common Options

Description

Formats CSV data with a custom delimiter or CRLF line endings.

Generally, all commands in qsv output CSV data in a default format, which is the same as the default format for reading CSV data. This makes it easy to pipe multiple qsv commands together. However, you may want the final result to have a specific delimiter or record separator, and this is where 'qsv fmt' is useful.

For examples, see https://github.com/dathere/qsv/blob/master/tests/test_fmt.rs. See also https://github.com/dathere/qsv/wiki/Transform-and-Reshape#fmt

Usage

qsv fmt [options] [<input>]
qsv fmt --help

Fmt Options

       Option       TypeDescriptionDefault
 ‑t,
‑‑out‑delimiter 
stringThe field delimiter for writing CSV data. Must be a single character. "T" or "\t" can be used as shortcuts for tab.,
 ‑‑crlf flagUse '\r\n' line endings in the output.
 ‑‑ascii flagUse ASCII field/record separators: Unit Separator (U+001F) for fields and Record Separator (U+001E) for records. Substitute (U+001A) is used as the quote character.
 ‑‑quote stringThe quote character to use. Must be a single character."
 ‑‑quote‑always flagPut quotes around every value.
 ‑‑quote‑never flagNever put quotes around any value.
 ‑‑escape stringThe escape character to use. When not specified, quotes are escaped by doubling them.
 ‑‑no‑final‑newline flagDo not write a newline at the end of the output. This makes it easier to paste the output into Excel.

Common Options

     Option     TypeDescriptionDefault
 ‑h,
‑‑help 
flagDisplay this message
 ‑o,
‑‑output 
stringWrite output to instead of stdout.
 ‑d,
‑‑delimiter 
stringThe field delimiter for reading CSV data. Must be a single character. (default: ,)

Source: src/cmd/fmt.rs | Table of Contents | README