3

Firstly the only thing I have available is powershell. I have figured out how to compare two arrays; however, I am having a bit if difficulty figuring out how to get the data back in the format I need.

$foo = @(100, 200 ,300 ,400 ,500 ,600 ,700 ,800 ,900 ,1000)
$bar = @(50, 100, 600 , 900)

Desired results would be an array with the following information

 50, 200, 300, 400, 500, 700, 800, 1000

Note that the like values

100, 600 , 900

are dropped and

50 

which is in the second array is added to the output.

is this possible?

thanks

0

1 Answer 1

14

Compare-Object is your friend:

PS C:\Users> $foo = @(100, 200 ,300 ,400 ,500 ,600 ,700 ,800 ,900 ,1000)
PS C:\Users> $bar = @(50, 100, 600 , 900)
PS C:\Users> Compare-Object $foo $bar -PassThru
50
200
300
400
500
700
800
1000
Sign up to request clarification or add additional context in comments.

2 Comments

Ha! I knew it had to be simple. Thank you so very much ravikanth
Welcome! PowerShell is simple! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.