Filter, Sort, Count

Filter, Sort, Count: Filtering: Where-Object and Comparisons, Sorting: Sort-Object, Counting and Grouping: Measure-Object and Group-Object.

Updated

  1. Filtering: Where-Object and Comparisons (Apprentice): Where-Object keeps only the objects that pass a test, such as every file over 1 MB or every song, and the test is written with comparisons read aloud as words, -eq "equals", -gt "greater than", -like "is like", with $_ standing for this item.
  2. Sorting: Sort-Object (Apprentice): Sort-Object puts objects in order by any property, smallest or A first unless you add -Descending, and with Select-Object -First after it gives you the top ten of anything, such as the ten biggest files on a drive; -Unique lists each value once.
  3. Counting and Grouping: Measure-Object and Group-Object (Apprentice): Measure-Object counts the objects a pipeline hands it and adds up, averages or finds the largest of one property, such as the total size of every file, and Group-Object sorts objects into piles by a property, such as one pile per file type, each with a count.