Skip to main content
Version: 4.2.0

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

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