Grouping and measuring
Group-Object is a powerful command that allows objects to be grouped together under a single property name or an expression.
Measure-Object supports several simple mathematical operations, such as counting the number of objects, calculating an average, calculating a sum, and so on. Measure-Object also allows characters, words, or lines to be counted in text fields.
The Group-Object command
The Group-Object command shows a Group and Count for each occurrence of a value in a collection of objects.
Given the sequence of numbers shown, Group-Object creates a Name that holds the value it is grouping, a Count as the number of occurrences of that value, and a Group property as the set of similar values:
PS> 6, 7, 7, 8, 8, 8 | Group-Object
Count    Name                   Group
-----    ----                   -----
    1    6                      {6}
    2    7                      {7, 7}
    3    8                      {8, 8, 8}
    The Group...