2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
title: each group
|
|
|
|
layout: command
|
|
|
|
version: 0.59.0
|
|
|
|
---
|
|
|
|
|
|
|
|
Runs a block on groups of `group_size` rows of a table at a time.
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
|
|
|
```> each group (group_size) (block)```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
- `group_size`: the size of each group
|
|
|
|
- `block`: the block to run on each group
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Echo the sum of each pair
|
|
|
|
```shell
|
2022-02-20 02:13:33 +01:00
|
|
|
> echo [1 2 3 4] | each group 2 { |it| $it.0 + $it.1 }
|
2022-02-14 03:22:51 +01:00
|
|
|
```
|