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