title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
Friday, January 02, 2015 | |
I'm not sure how I was supposed to tease it out of the help for Sort-Object, but you can apparently just put in a script-block for Sort-Object that'll operate on each object in an array just like any other pipeline function. Painfully difficult to google up, for some reason, though I eventually found it here: So if I have an array of hashtables called $ahash, and each hashtable in $ahash has a property called `name`, I can just do this... $sorted = $ahash | Sort-Object { $_.name }; Voila. Maybe that's in the help, but I didn't see it. There some script block stuff described under `-Property<Object[]>`, but that's specifically for the Property param, which isn't exactly what I think we want. Lots easier than writing an IComparer and .NETting around your elbow to get back to your nose. /shrug
Labels: noteToSelf, powershell posted by ruffin at 1/02/2015 10:58:00 AM |
|
| |
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
![]() |
|
|