y
y
yq
Search…
Working with CSV, TSV

Yaml to CSV/TSV

You can convert compatible yaml structures to CSV or TSV by using:
  • --outputformat=csv or -o=c for csv (comma separated values)
  • --outputformat=tsv or -o=t for 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).
1
- [i, like, csv]
2
- [because, excel, is, cool]
Copied!
then
1
yq e '.' -o=csv sample.yaml
Copied!
will output:
1
i,like,csv
2
because,excel,is,cool
Copied!
Similarly, for tsv:
1
yq e '.' -o=tsv sample.yaml
Copied!
will output:
1
i like csv
2
because excel is cool
Copied!
Last modified 1mo ago
Copy link