CSVFORMAT(1)

✨ hey bestie, welcome to CSVFORMAT(1) β€” aka csvformat(1) β€” from csvkit ✨

πŸ’– NAME πŸ’–

csvformat β€” literally the csvformat Documentation. that's the name, that's the vibe. πŸ‘‘


✨ DESCRIPTION ✨

okay so the whole point is: Convert a CSV file to a custom output format.: πŸ¦‹

here's the synopsis, exactly as it should be typed, no cap:

usage: csvformat [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
                 [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING]
                 [-L LOCALE] [-S] [-H] [-K SKIP_LINES] [-v] [-l] [--zero] [-V]
                 [-E] [-D OUT_DELIMITER] [-T] [-A] [-Q OUT_QUOTECHAR]
                 [-U {0,1,2,3}] [-B] [-P OUT_ESCAPECHAR]
                 [-M OUT_LINETERMINATOR]
                 [FILE]

πŸŽ€ positional arguments πŸŽ€

  • FILE β€” the CSV file to operate on. If you omit it, it will accept input as piped data via STDIN. she's flexible like that. πŸ’…

🌸 optional arguments 🌸

  • -h, --help β€” show this help message and exit. iconic.
  • -E, --skip-header β€” do not output a header row. no header, no problem.
  • -D OUT_DELIMITER, --out-delimiter OUT_DELIMITER β€” the delimiting character of the output file. pick your separator, bestie.
  • -T, --out-tabs β€” says the output file is delimited with tabs. it overrides -D. tabs ate.
  • -A, --out-asv β€” says the output file is delimited with the ASCII unit separator and record separator. it overrides -T, -D and -M. asv is the moment.
  • -Q OUT_QUOTECHAR, --out-quotechar OUT_QUOTECHAR β€” the character used to quote strings in the output file. quote her.
  • -U {0,1,2,3}, --out-quoting {0,1,2,3} β€” quoting style used in the output file: 0 quote minimal, 1 quote all, 2 quote non-numeric, 3 quote none. choose your fighter.
  • -B, --out-no-doublequote β€” whether or not double quotes are doubled in the output file. double or not, that's the question.
  • -P OUT_ESCAPECHAR, --out-escapechar OUT_ESCAPECHAR β€” the character used to escape the delimiter in the output file if --quoting 3 ("Quote None") is specified and to escape the QUOTECHAR if --out-no-doublequote is specified. escape room energy.
  • -M OUT_LINETERMINATOR, --out-lineterminator OUT_LINETERMINATOR β€” the character used to terminate lines in the output file. bye line, bye.

also the synopsis has these common arguments: -d DELIMITER, -t, -q QUOTECHAR, -u {0,1,2,3}, -b, -p ESCAPECHAR, -z FIELD_SIZE_LIMIT, -e ENCODING, -L LOCALE, -S, -H, -K SKIP_LINES, -v, -l, --zero, -V. their deets are in the common tools docs, iykyk.

See also: Arguments common to all tools.


🌈 EXAMPLES 🌈

  1. Convert a comma-separated file to a pipe-delimited file:
csvformat -D "|" examples/dummy.csv
  1. Convert to carriage return line-endings:
csvformat -M $'\r' examples/dummy.csv
  1. Convert to a tab-delimited file (TSV) with no doubling of double quotes:
printf 'key,value\n1,"a ""quoted"" string"' | csvformat -T -Q🐍
  1. To avoid escaping quote characters when using --quoting 3, add --out-quotechar "":
csvformat -u3 -U3 -Q🐍 examples/optional_quote_characters.csv

πŸ‘‘ AUTHOR πŸ‘‘

Christopher Groskopf and contributors. the icons, the legends. πŸ’–

2016, Christopher Groskopf and James McKinney. periodt. 🫢


kisses bestie, this was csvkit version 2.2.0, Aug 16, 2024. bye! πŸ’…βœ¨

πŸ“¦ where this page comes from