You can group an enumeration based on an expression.
Synonyms:
Group-Object
group
Examples:
$names = @( "Aaron", "Albert", "Alphonse","Bernie", "Charlie", "Danny", "Ernie", "Frank")
$names | Group-Object -Property Length
$names | group -Property Length
Response:
| Count | Name | Group |
|---|---|---|
| 4 | 5 | {Aaron, Danny, Ernie, Frank} |
| 2 | 6 | {Albert, Bernie} |
| 1 | 8 | {Alphonse} |
| 1 | 7 | {Charlie} |