Exercise 1: Why PowerShell's Pipeline Skips Text Parsing — Possible Solution
====================================================================
WHAT ps AND awk WOULD NEED TO DO IN BASH
------------------------------
In a Bash pipeline, ps outputs plain text - rows of
columns separated by whitespace, with memory usage as just one column
among several, formatted as a printed string. To filter by memory
usage, awk would need to know exactly which column
position holds the memory figure, split each line on whitespace, and
extract that specific field as text before it could even be compared
numerically.
WHY POWERSHELL'S PIPELINE NEEDS NONE OF THAT
------------------------------
Per this chapter, "PowerShell pipes objects - structured data with real
properties - so a command receiving piped input already has direct
access to named fields, with no text-parsing step required at all."
Get-Process doesn't output printed text rows at all - it
outputs actual process objects, each one already carrying a real
WorkingSet property representing memory usage.
Where-Object { $_.WorkingSet -gt 200MB } reads that
property directly by name, with no column position, whitespace
splitting, or text-to-number conversion involved anywhere.
WHY THIS MAKES THE COMPARISON A REAL STRUCTURAL DIFFERENCE, NOT JUST STYLE
------------------------------
This isn't a difference in how each shell happens to be written - it
reflects two fundamentally different pipeline designs. Bash's pipeline
was built around passing text between small, independent Unix
utilities, each interpreting that text however it needs to. PowerShell's
pipeline was built around passing structured objects between cmdlets,
so every cmdlet downstream already has typed, named access to whatever
the previous cmdlet produced.
WHY THIS MATTERS BEYOND THIS ONE EXAMPLE
------------------------------
Any PowerShell pipeline reading a specific property, regardless of the
object type, works the same reliable way this example does - no
column-position guessing, no risk of a text format change silently
breaking a script's own parsing logic, which is a real, ongoing
maintenance risk in text-pipeline scripts whenever a tool's output
format changes even slightly.
WHY THIS WORKS AS AN ANSWER
------------------------------
It describes concretely what a Bash-based awk pipeline would need to do
to extract memory usage from ps output, contrasts that directly with
how PowerShell's own object property access works using this chapter's
own explanation, and frames the difference as a genuine structural
design choice rather than incidental style.