Get-Content .\example.csv | ConvertFrom-Csv | Where-Object -Property color -eq red
Get-Content .\example.csv | ConvertFrom-Csv | Where-Object -Property color -eq red
I appreciate that it auto-corrects capitalization and slash direction.
ipcsv example.csv | ? color -eq red
color shape flag index
----- ----- ---- -----
red square 1 15
red circle 1 16
red square 0 48
red square 0 7Unfortunately after working with it for a few years I utterly despise PowerShell for many other reasons.
I've probably forgotten a few things.
The expressiveness is nice, but oftentimes modules won't support it or require weird ways of using the data to get the performance you want (mostly by dropping out of the pipe.)
The choices around Format- vs Out- vs Convert- are Very Confusing for new people and the "object in a shell but also text sometimes" way of displaying things is weird and until recently things like -NoTypeInformation or managing encoding in files was just pointlessly weird.
The module support and package management is still entirely in the stone ages and I regularly see people patching in C# in strings to get the behavior they want.
"Larger" modules tend to get Really Slow - the azure modules especially are just an example of how not to do it.
The way it automatically unwraps collections is cool, but gets weird when you have a 1 vs many option for your output, and you might find yourself defensively casting things to lists or w/e.
The typing system in general is nice to get started on but declaring a type does not fix it, so assignment can just break your entire world.
There's still a lot to love about the language when you are getting things done in a windows environment its great to glue together the various pieces of the system but I find the code "breaks" more often than equivalent python code.
PowerShell isn't even fast enough for basic interactive usage, never mind batch processing.
Searching for that comment, I came across relevant stories:
It's one of the parents in that comment chain (top comment on the story): https://news.ycombinator.com/item?id=26791597
You’re right that standard Unix tools don’t have a concept of types in streams, but that decision got made deliberately. Types and formats got left as output details.
Analogously my Macbook Air doesn’t have a fan, by design, not by accidental omission.
Having human-readable text as the lowest common denominator is a laudable goal. Shell scripting would however probably be improved if most tools offered alternative typed streams, or something similar. I am not convinced Powershell's approach is the best, but their approach is at least interesting.
The original decision was about not proliferating specialized or proprietary binary formats, which was more of a norm back in the ‘70s than today. The goal was to make small single-purpose tools that communicated through a common interface (files) in a standard format (plain text). Unix succeeded and continues to succeed at that.
Nothing about those design decisions precludes tools using binary formats under Unix — image processing, for example. It just precludes using standard text-oriented tools on those formats.