比较两个数组 &获取不常见的值 [英] Comparing two arrays & get the values which are not common
本文介绍了比较两个数组 &获取不常见的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个小逻辑来比较两个数组的内容 &使用powershell获取其中不常见的值
i wanted a small logic to compare contents of two arrays & get the value which is not common amongst them using powershell
例子如果
$a1=@(1,2,3,4,5)
$b1=@(1,2,3,4,5,6)
$c 作为输出应该给我值6
",它是两个数组之间不常见值的输出.
$c which is the output should give me the value "6
" which is the output of what's the uncommon value between both the arrays.
有人可以帮我解决这个问题吗!谢谢!
Can some one help me out with the same! thanks!
推荐答案
PS > $c = Compare-Object -ReferenceObject (1..5) -DifferenceObject (1..6) -PassThru
PS > $c
6
这篇关于比较两个数组 &获取不常见的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文