For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 '.a | length' sample.yml

will output

3

null length

Given a sample.yml file of:

a: null

then

yq '.a | length' sample.yml

will output

0

Map length

returns number of entries

Given a sample.yml file of:

then

will output

Array length

returns number of elements

Given a sample.yml file of:

then

will output

Last updated