Compare csv and output the difference

Hi
I have two csv files
Oldcsv
Server
IP
State
Box1
192.168.25.1
Enabled
Box2
192.168.25.2
Enabled
Box3
192.168.25.3
Enabled
newcsv
Server
IP
State
Box1
192.168.25.1
Enabled
Box2
192.168.25.2
Disabled
Box3
192.168.25.3
Disabled
OUtput should be
Server
IP
OldState
NewState
Box2
192.168.25.2
Enabled
Disabled
Box3
192.168.25.3
Enabled
Disabled
Actuall files contains thousand of boxes.
I have tried compare-object 
with passthru . But unable to get the desired result. Please Assit/Guide Me.
Thanks
Neo

## checking differences
$a = Import-Csv .\csv1.csv
$b = Import-csv .\csv2.csv
$compare = Compare-Object -ReferenceObject $b -DifferenceObject $a -Property State -PassThru
Write-host "Change of state"
$result = $compare |?{$_.Sideindicator -eq "<="}
$result |%{$c=$_.server;$compare |?{$_.server-eq $c}}
I cant figure out how to put OldState and NewState together.. lol
Trying this way but still no luck
$compare|?{$_.Sideindicator
-eq"<="}
|select@{n="Server";e={$_.server}},@{n="OldState";e=
.... get the State from variable $a where server equal $_ .. 

Similar Messages

  • Compare two tables and log the difference

    Hi,
    I want to compare two tables and log the difference in new table with the fields as (old value,new value, column name). The column name should be the changes value column

    Can you show an example?
    SELECT Foo.*, Bar.*
       FROM Foo
            FULL OUTER JOIN
            Bar
            ON Foo.c1 = Bar.c1
               AND Foo.c2 = Bar.c2
               AND Foo.cn = Bar.cn
     WHERE Foo.key IS NULL 
        OR Bar.key IS NULL; 
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Script to compare 2 tables and retrieve the differences in records data

    Dear All,
    please I need a script to compare two oracle database tables and retrieves the differences in data records between the two tables.
    I have tried this one :
    -- all rows that are in T1 but not in T2
    (select * from T1 minus select * from T2)
    union all
    -- all rows that are in T2 but not in T1
    (select * from T2 minus select * from T1);
    But it generates the following error:
    ORA-01789: query block has incorrect number of result columns
    Thank you for your cooperation , please it is urgent

    ok I used this statement with dblink, the problem is that i cannot use PL/SQL developer since it is a process repeated for 300 tables , that why i am trying to automate it:
    -- all rows that are in T1 but not in T2
    (select * from schema.T1minus select * from T2@dblink_name)
    union all
    -- all rows that are in T2 but not in T1
    (select * from T2@dblink_name minus select * from schema.T1);
    I created the db link on a database A and when i run the statement
    (select * from schema.T1minus select * from T2@dblink_name)
    on the database B i get the error ORA-02019: CONNECTION DESCRIPTION FOR REMOTE DATABASE NOT FOUND.
    DOes anybody have an idea please

  • How to compare two images and display the difference on Front Panel

    HI..
    I have attached two images.
    I want to compare these two images and subtract the differenc from these two images and display the difference(the mouse) on the front panel
    Anyone can help me?
    Really thanks
    Attachments:
    IMG_2117.JPG ‏1677 KB
    IMG_2118.JPG ‏1650 KB

    The missing thing. You have to keep in mind that what you see is not the same as the camera sees.
    So when using IMAQ Substract it gives you the difference of the value of every single pixel!
    In order to find the mouse as only difference you have to manage that every other pixel value stays the same, e.g. with a proper lightening.
    At the other hand you can combine different filters or alogorithms to get the object, e.g. if the object is darker or brighter then everything else in the image you could use a threshold and then use morphologic operations to get the objects size and position.
    Christian

  • Macro to compare CSV and Excel file

    Team,
    Do we have any macro to compare CSV and Excel file.
    1) In Excel we should have two text boxes asking the user to select the files from the path where they have Stored
    2) First Text is for CSV file
    3) Second Text box is for Excel file
    4) We Should have Compare button that should run the Macro and Show the Differences.
    Thanks!
    Kiran

    Hi
    Based on my understanding, we need to convert the 2 files into the same format before comparing two different formats files. 
    Here are the options:
    1. Convert the CSV file and Excel file into 2-dim Arrays, then compare them, about how to load a CSV file into VBA array, you can search it from
    internet or ask a solution in VBA forum.
    VBA forum:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    2. Also you can import CSV file to Excel sheet, and then compare them.
    Here is the sample code for your reference:
    ‘import csv file
    Sub InputCSV()
    Dim Wb As Workbook
    Dim Arr
    Set Wb = GetObject(Application.GetOpenFilename("csv file,*.csv", , "please choose a csv file", , False))
    Arr = Wb.ActiveSheet.Range("A1").CurrentRegion
    Wb.Close False
    Range("A1").Resize(UBound(Arr), UBound(Arr, 2)) = Arr
    End Sub
    ‘compare sheet
    Sub CompareTable()
    Dim tem, tem1 As String
    Dim text1, text2 As String
    Dim i As Integer, hang1 As Long, hang2 As Long, lie As Long, maxhang As Long, maxlie As Long
     Sheets("Sheet1").Select
    Columns("A:A").Select
    With Selection.Interior
    .Pattern = xlNone
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("A1").Select
    Sheets("Sheet2").Select
    Rows("1:4").Select
    With Selection.Interior
    .Pattern = xlNone
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("A1").Select
    MaxRow = 250
    MaxColumn = 40
    For hang1 = 2 To maxhang
    Dim a As Integer
    a = 0
    tem = Sheets(1).Cells(hang1, 1)
    For hang2 = 1 To maxhang
    tem1 = Sheets(2).Cells(hang2, 1)
    If tem1 = tem Then
    a = 1
    Sheets(2).Cells(hang2, 1).Interior.ColorIndex = 6
    For lie = 1 To maxlie
    text1 = Sheets(1).Cells(hang1, lie)
    text2 = Sheets(2).Cells(hang2, lie)
    If text1 <> text2 Then
            Sheets(2).Cells(hang2, lie).Interior.ColorIndex = 8
    End If
    Next
    End If
    Next
    If a = 0 Then
    Sheets(1).Cells(hang1, 1).Interior.ColorIndex = 5
    End If
    Next
    Hope this will help.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Read from .txt file and output the content as two arrays

    I am using the contoured move to control the x-y stage. The trajectory datas for x and y axis are generated using my interpolation program and it is stored in a .txt file as two columns. What I want to do is read .txt file and output the content of this file as two arrays. Is there anyone has any ideas? Thanks, the .txt file is attached.
    Attachments:
    R.75.txt ‏172 KB

    Hi Awen,
    This is quite easy to do, you can merely use the "read from spreadsheet file" function to get a 2D array (2 columns and n rows) and then use the index array function to get whatever row/colums you want..
    Hope the attached VI helps you
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    read sprdsheet file.vi ‏27 KB

  • If i have an unlocked iphone 5 can i upgrade it to an iphone 5s and pay the difference ?

    if i have an unlocked iphone 5 can i upgrade it to an iphone 5s and pay the difference?

    Then, you own the phone. Your only options are sell the phone yourself or see what programs are offered by third-parties or your carrier.

  • How to Find the highest and lowest cell in a column and figure the difference

    What I am tryng to do is have numbers find the high and low in Cloumn B and and put the difference in B6. So I would need it to Figure out that B3 is the highest and B2 is the lowest and give me the difference of .25 in B6

    Don,
    Begin by making Row 6 a Footer Row. You will find that option in the row tab menu that appears when you hover over the 6 tab and click the triangle.
    Then enter this formula in B6:
    =MAX(B)-MIN(B)
    Regards,
    Jerry

  • I have a fully functioning iPhone 4S that has been in water, it has left slight water marks on screen, everything else works and is in mint condition. I want to exchange it for an iphone 5s and pay the difference. Would this be possible at the apple store

    I have a fully functioning iPhone 4S in mint condition apart some water marks on screen (dropped in bath) everything works perfectly as it should. I wish to exchange and pay the difference for an iphone 5s. Is this possible from the apple store (uk) how much do they normally give as a trade in and how much do they charge for an iphone 5s. Or should I just take it in and see if they will do a one for one swap and pay the difference. ( I don't like the water marks, it's annoying, maybe they will go away, I don't know) been sat in rice for a week.

    The only thing Apple will do for you is an out of warranty exchange, & you will get EXACTLY what you have now. The cost will be US $199. Make an appointment at any Apple store.

  • I have iphone 5 can i change it from apple and pay the difference bettween both value

    i have iphone 5 can i change it from apple and pay the difference bettween both value

    Ask your retailer.  At worst, you can sell your iPhone 5 independently (of Apple and your retailer) and separately purchase the later model.

  • Possible to sync multiple files and output the merged clips?

    I'm working on a documentary project and have hundreds of individual clips from multiple Canon C-300 cameras and a multi-track master audio recording from a SoundDevices 744.  Since this is a documentary the cameras aren't slating every take, instead they all have Lockit boxes generating timecode that is slaved to the master clock on the 744.
    What I need to do it sync the pictures and the sound and output the sync'd files for screening and editorial.  ScratchLab is not sync'ing the material properly but bringing a clip into Premiere is locked up without a problem.
    Is there a way to sync the audio/video and output individual sync'd files using the tools in the CS6 suite?  Please keep in mind that there are hundreds of individual clips so the process would have to be automated.
    Cheers!

    That is so incredible !!!!
    I also have hundred of start/stop clips with TC and audio start/stop with TC too, and I don't find a way to place the clips on the timeline at the right place of the TC.... The clips are R3D and the sound comes from a 788T. Nothing special. I work a lot with Premiere and Red and I LOVE IT.
    What ? I should record audio on the Red just to permit PluralEyes to do thesync from audio ??
    Please Adobe team, tell me I am sleeping and when i wake up there will be a soluce !

  • Can i change my iPad 3 16gb for an iPad 3 32gb and pay the difference?

    I wanna know if is possible change my ipad 3 16gb for an new ipad 3 32gb and pay the difference. Thanks

    If you purchased it within the past 14 days, Apple may do a trade. See http://store.apple.com/us/help/returns_refund
    Otherwise, your only option is to sell the iPad and buy a new one.
    How to Sell Your Old iPad  http://tinyurl.com/85d69lk
    Other sources to sell.
    eBay Instant Sell http://instantsale.ebay.com/?search=ipad
    Sell and Recycle Used Electronics - Gazelle http://www.gazelle.com/
    For instant gratification in selling a used iPhone or iPad, Gazelle’s Gadget Trader, an iOS app, is tough to beat. In seconds it detects the device and reveals how much it is worth in good condition. Tap the Sell This Phone to Gazelle button and the deed is done.
    Sell Electronics for Cash - Next Worth  http://www.nextworth.com/
    Buy My Tronics  http://www.buymytronics.com/
    Sell Your iPad http://www.sellyourmac.com/mac-product-guides/ipad.html
    Totem http://www.hellototem.com/
     Cheers, Tom

  • If i wanted to get the new ipod, could i just bring in my ipod touch and pay the difference?

    I have the ipod touch, fourth generation. And i want to get the newest version of the ipod touch. Would i go to the apple store and give in my ipod and pay the difference to get the new ipod? Or would that not matter and i would still have to pay full price for the newest ipod?

    ipod over 14-30 days over like several months.... u get a 10% recycle apple uses. u wont get the full amount u payed for for that ipod

  • I dropped my iphone 4s in water and everything works but the backlight. I have heard rumors that I can take my damaged iPhone into an apple store and trade it in for a new phone and pay the difference. Is this true?

    I dropped my iphone 4s in water and everything works but the backlight. I have heard rumors that I can take my damaged iPhone into an apple store and trade it in for a new phone and pay the difference. Is this true?

    Apple offers an out of warranty or not covered under the warranty "repair" price, which pays for an exchange at a discounted price off the full retail sales price.

  • Today I've bought a Mac Book Pro laptop from Florida Mall. Can I change it with a Mac Book Air and pay the difference?

    Today I've bought a Mac Book Pro laptop from Florida Mall. Can I change it with a Mac Book Air and pay the difference?

    Yes, you have 14 days to return it.
    Cheers,
    GB

Maybe you are looking for

  • How do I edit a map in adobe acrobat?

    Hello? I have a document in adobe acrobat that I am using adobe reader to view. It is a map of my workplace and I'd like to make some alterations to this map. How do I do this? Can I do this? Do I need a full version of adobe and not just the reader?

  • MIRO User - Exit to Change the Profit Centre..?

    I need to change the Profit Centre in the Accounting document(for Vendor Line Item) and Profit Centre Accounting Document(For Payable Line Item) Created by MIRO Transaction.Can any one let me know if there is anyuser-exit or badi to achieve the same

  • Can I control a repeat region in Dreamweaver?

    I am using ASP webpage with the following code. I get the results I want. I use a dynamic repeat table to display the data. I would like to display it like Sample# 2 in the attached Excel spreadsheet (newResults). Is there a way to do this in Dreamwe

  • Address Book - duplicating a record

    One of the most basic functions of any database ever created is "Duplicate Record." The verb duplicate, not the noun. If I want to send USPS mail to ten colleagues at this address: John Doe President Acme, Beta and Crumhorn Widgets 10234 Long Winding

  • E71,E72 in corporate environment , user data

    Company has tens of Eseries phones in use. Quite often phone will be handed over for use to other employee. IT should clean personal data like exchange e-mails, SMS, contacts, calendar, notes before. Has anybody solution to remove personal data easy,