y
y
yq
Search…
Working with CSV, TSV
Note that versions prior to 4.18 require the 'eval/e' command to be specified.
yq e <exp> <file>

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 '.' -o=csv sample.yaml
Copied!
will output:
1
i,like,csv
2
because,excel,is,cool
Copied!
Similarly, for tsv:
1
yq '.' -o=tsv sample.yaml
Copied!
will output:
1
i like csv
2
because excel is cool
Copied!
Copy link