# Filter, Sort, Count

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

Updated: November 10, 2026

1. [Filtering: Where-Object and Comparisons](https://www.ask-codey.com/lessons/powershell-where-object) (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](https://www.ask-codey.com/lessons/powershell-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](https://www.ask-codey.com/lessons/powershell-measure-and-group) (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.

Source: https://www.ask-codey.com/courses/powershell-in-depth/topics/powershell-filter-sort-count
