Skip to main content
Version: v1.15.0

any

Aggregate Function

any select an arbitrary input value

Synopsis

any(any) -> any

Description

The any aggregate function returns an arbitrary element from its input. The semantics of how the item is selected is not defined.

Examples

Any picks the first one in this scenario but this behavior is undefined:

echo '1 2 3 4' | zq -z 'any(this)' -

=>

1

Continuous any over a simple sequence:

echo '1 2 3 4' | zq -z 'yield any(this)' -

=>

1
1
1
1

Any is not sensitive to mixed types as it just picks one:

echo '"foo" 1 2 3 ' | zq -z 'any(this)' -

=>

"foo"