$var | sort -Unique COUNT $var | sort -Unique COUNT matches: $var | sort -Unique -Property COUNT $var | sort -Unique -Property COUNT
So what sorting does is look for the "COUNT" property for each of the elements in the array to determine whether they are unique or not. You can see how this works if you do the following:
GPS sv* | sort -Unique ID GPS sv* | sort -Unique Name
Since none of the objects has the "COUNT" property, sorting considers them all the same, and therefore no one is unique and returns one of the elements. The hint came from trying:
$var = $("a", "b", "c", "b") $var | sort -Unique count
this led to result "c".
Measure is your friend here:
$var |sort -Unique |measure
That should do the trick.
source share