mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-15 23:58:04 +00:00
744 B
744 B
Length
Returns the lengths of the nodes. Length is defined according to the type of the node.
String length
returns length of string
Given a sample.yml file of:
a: cat
then
yq eval '.a | length' sample.yml
will output
3
null length
Given a sample.yml file of:
a: null
then
yq eval '.a | length' sample.yml
will output
0
Map length
returns number of entries
Given a sample.yml file of:
a: cat
c: dog
then
yq eval 'length' sample.yml
will output
2
Array length
returns number of elements
Given a sample.yml file of:
- 2
- 4
- 6
- 8
then
yq eval 'length' sample.yml
will output
4