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
Parameter | Description | Required? | Default Value |
---|---|---|---|
size | Desired number of elements per chunk | ❌ | 100 |
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