2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
title: group-by
|
|
|
|
layout: command
|
|
|
|
version: 0.59.0
|
|
|
|
---
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
Create a new table grouped.
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
## Signature
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
```> group-by (grouper)```
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
## Parameters
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
- `grouper`: the grouper value to use
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
## Examples
|
2019-11-16 15:31:28 +01:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
group items by column named "type"
|
2019-11-16 15:31:28 +01:00
|
|
|
```shell
|
2022-02-14 03:22:51 +01:00
|
|
|
> ls | group-by type
|
2019-11-16 15:31:28 +01:00
|
|
|
```
|
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
you can also group by raw values by leaving out the argument
|
2019-11-16 15:31:28 +01:00
|
|
|
```shell
|
2022-02-14 03:22:51 +01:00
|
|
|
> echo ['1' '3' '1' '3' '2' '1' '1'] | group-by
|
2019-11-16 15:31:28 +01:00
|
|
|
```
|