Question:
how can I get the object with smaller name size from an array?
$a
Name Value
—- —–
name A
name AAAA
name BB
name AAAAAA
$a | get-smaller -property “name” ==> should return the object with name = A
thanks
Answer:
1 2 |
$a | sort { $_.value.length } | select -expand value -first 1 |