mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-06 04:45:39 +00:00
GitBook: [#217] No subject
This commit is contained in:
parent
deb71a277c
commit
dd22aada6d
@ -1,15 +1,17 @@
|
|||||||
# Working with CSV and TSV
|
# Working with CSV, TSV
|
||||||
|
|
||||||
{% hint style="warning" %}
|
{% hint style="warning" %}
|
||||||
Note that versions prior to 4.18 require the 'eval/e' command to be used.
|
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
|
||||||
|
|
||||||
`yq e <exp> <file>`
|
`yq e <exp> <file>`
|
||||||
{% endhint %}
|
{% endhint %}
|
||||||
|
|
||||||
## Yaml to CSV/TSV
|
## Yaml to CSV/TSV
|
||||||
|
|
||||||
You can convert compatible yaml structures to CSV or TSV by using:
|
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)
|
* `--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).
|
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).
|
||||||
|
|
||||||
@ -39,8 +41,7 @@ yq '.' -o=tsv sample.yaml
|
|||||||
|
|
||||||
will output:
|
will output:
|
||||||
|
|
||||||
```tsv
|
```
|
||||||
i like csv
|
i like csv
|
||||||
because excel is cool
|
because excel is cool
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user