mirror of
https://github.com/mikefarah/yq.git
synced 2026-06-30 17:21:42 +00:00
682 B
682 B
Working with CSV and TSV
Yaml to CSV/TSV
You can convert compatible yaml structures to CSV or TSV by using:
--outputformat=csvor-o=cfor csv (comma separated values)--outputformat=tsvor-o=tfor tsv (tab separated values)
Compatible structures is either an array of scalars (strings/numbers/booleans), which is a single row; or an array of arrays of scalars (multiple rows).
- [i, like, csv]
- [because, excel, is, cool]
then
yq '.' -o=csv sample.yaml
will output:
i,like,csv
because,excel,is,cool
Similarly, for tsv:
yq '.' -o=tsv sample.yaml
will output:
i like csv
because excel is cool