Skip to main content
Version: 2.4.7

count Command

The count command returns the number of elements or properties in the piped input.

When no argument is provided to the command, the total number of elements is returned.

When a property name is provided, the number of elements with the specified property is returned rather than the total number of input elements.

Usage‚Äč

count <property>

Parameters‚Äč

ParameterDescriptionRequired?Default Value
propertyName of property to count‚ĚĆN/A

Examples‚Äč

> json [{"a": 1}, {"a": 2}, {"a": 1}] | count
‚Äčtotal matched: 3
‚Äčtotal unmatched: 0
> json [{"a": 1}, {"a": 2}, {"a": 1}] | count a
‚Äč2: 1
‚Äč1: 2
‚Äčtotal matched: 3
‚Äčtotal unmatched: 0
> json [{"a": 1}, {"a": 2}, {"a": 3}] | count b
‚Äčtotal matched: 0
‚Äčtotal unmatched: 3
> search all | count
‚Äčtotal matched: 142670
‚Äčtotal unmatched: 0
> search all | count /ancestors.cloud.reported.name
‚Äčgcp: 42403
‚Äčaws: 93168
‚Äčtotal matched: 135571
‚Äčtotal unmatched: 0