如何从powershell中的哈希表数组中获取唯一值?
$h1 = @{a=1;b=2};
$h2 = @{a=3;b=4};
$h3 = @{a=1;b=2};
$h = $h1,$h2,$h3
我想从 $h 中删除重复值($h1 或 $h3)。
谢谢!
最佳答案
你可以尝试这样的事情:
$h | select @{ Expression = { "$($_.Keys):$($_.Values)" }; Label ="AsString" }, @{ Expression ={$_}; Label = "Hash" } -unique
| select -expand Hash
关于powershell - 如何从powershell中的哈希表数组中获取唯一值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14332930/