比较两个数组&安培;得到这是不常见的值 [英] Comparing two arrays & get the values which are not common
本文介绍了比较两个数组&安培;得到这是不常见的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想一个小逻辑比较两个阵列和放大器的内容;得到中使用PowerShell这是不常见的是他们中值
例如,如果
$ A1 = @(1,2,3,4,5)
$ B1 = @(1,2,3,4,5,6)
$ C这是输出应该给我值 6
,这是一个什么样的两个阵列之间的不凡价值输出。
有人能帮助我一样!谢谢!
解决方案
PS> $ C =比较对象-ReferenceObject(1..5)-DifferenceObject(1..6)-PassThru
PS> $ C
6
i wanted a small logic to compare contents of two arrays & get the value which is not common amongst them using powershell
example if
$a1=@(1,2,3,4,5)
$b1=@(1,2,3,4,5,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屋!
查看全文