compare object export imput objects without some headlines RRS feed

  • Question

  • i have a little script that compare two files.

    the result of the compare script is :

    InputObject                                                      SideIndicator
    -----------                                                         -------------
    D91W7-N0062 test Everyone FullControl                  =>
    D91W7-N0062 test2 Everyone FullControl                =>
    D91W7-N0062 test3 Everyone FullContro                l =>
    D91W7-N0062 test Everyone FullControl                   =>
    D91W7-N0062 test2 Everyone FullControl                 =>
    D91W7-N0062 test3 Everyone FullControl                 =>

    i must have only the imput objects when i try to export to a txt.

    my code is:

    Compare-Object -ReferenceObject $Oldfile -DifferenceObject $Newfile|Out-File differenze.txt

    what can i do?

    Tuesday, September 12, 2017 9:14 AM

All replies

  • Use a select statement to return only the InputObject.

    The output will duplicate all rows that are different.  Is that what you want?


    Tuesday, September 12, 2017 9:28 AM
  • no. there is a solution?
    Tuesday, September 12, 2017 9:46 AM
  • no. there is a solution?

    That is not a question Try asking a complete question please.


    Tuesday, September 12, 2017 10:07 AM
  • what i can do for don't duplicate the output?
    Tuesday, September 12, 2017 10:17 AM
  • You have to decide what you are trying to compare and why.  Do you want equal or unequal?


    Tuesday, September 12, 2017 10:30 AM
  • unequal

    Tuesday, September 12, 2017 10:36 AM
  • Then filter for only the side that you want.  Unequal will give you a row indicator twice.  You have to decide which side you want to save,  For differences in row exisitence the meaning of the output can be vague and ambiguous.

    Compare-Object is not useful for comparing text files. 


    Tuesday, September 12, 2017 10:44 AM