Skip to main content
Version: 3.0.4

chunk Command

The chunk command groups elements from the input stream into "chunks" of a defined size.

The final chunk may contain fewer elements than the defined chunk size.

Usage

chunk <size>

Parameters

ParameterDescriptionRequired?Default Value
sizeDesired number of elements per chunk100

Examples

Chunking with size of 2
> json [1,2,3,4,5] | chunk 2
[1, 2]
[3, 4]
[5]
Chunking with size of 3
> json [1,2,3,4,5] | chunk 3
[1, 2, 3]
[4, 5]
Chunking the output of a query (output omitted for brevity)
> search is(volume) limit 5 | chunk 3