PS: Filter selected rows with only max values as output?

Posted by David.Chu.ca on Stack Overflow See other posts from Stack Overflow or by David.Chu.ca
Published on 2010-05-05T23:09:46Z Indexed on 2010/05/05 23:48 UTC
Read the original article Hit count: 153

Filed under:

I have a variable results ($result) of several rows of data or object like this:

PS> $result | ft -auto;
name   value
----   -----
a          1
a          2
b          30
b          20
....

what I need to get all the rows of name and max(value) like this filtered output:

PS> $result | ? |ft -auto
name   value
----   -----
a          2
b          30
....

Not sure what command or filters available (as ? in above) so that I can get each name and only the max value for the name out?

© Stack Overflow or respective owner

Related posts about powershell