Help with Compare CSV and Output only Mismatch

Welcome Forums General PowerShell Q&A Help with Compare CSV and Output only Mismatch

Viewing 8 reply threads
  • Author
    Posts
    • #193321
      Participant
      Topics: 6
      Replies: 9
      Points: 63
      Rank: Member

      So here is my problem I am comparing two CSV with 2 column set for comparison.  If first column match and second column dont output  the result.

       

      Her is my script.

       

    • #193327
      Participant
      Topics: 15
      Replies: 1761
      Points: 3,167
      Helping Hand
      Rank: Community Hero

      It looks like you are trying to join two objects. This was just discussed in a post recently. Take a look at this post:

      Combining data – how to also add data that is in set2 and not set1?

    • #193330
      Participant
      Topics: 6
      Replies: 9
      Points: 63
      Rank: Member

      It looks like you are trying to join two objects. This was just discussed in a post recently. Take a look at this post:

      Combining data – how to also add data that is in set2 and not set1?

      <iframe class=”wp-embedded-content” style=”position: absolute; clip: rect(1px, 1px, 1px, 1px);” title=”” src=”https://powershell.org/forums/topic/combining-data-how-to-also-add-data-that-is-in-set2-and-not-set1/embed/#?secret=PE7qaDTwIc&#8221; width=”600″ height=”338″ frameborder=”0″ marginwidth=”0″ marginheight=”0″ scrolling=”no” sandbox=”allow-scripts” data-secret=”PE7qaDTwIc” data-mce-fragment=”1″></iframe>

      My Script does exactly what I want except I want it to only Matching from column one and mismatch from column two and display result in column 3

    • #193333
      Participant
      Topics: 15
      Replies: 1761
      Points: 3,167
      Helping Hand
      Rank: Community Hero

      Explaining that you want something from, to perform matches, to determine differences, etc. on columnx and columny has no context. It is much easier for the community to assist you in parsing data if you provide an example of the data and an example of the end result, like the aforementioned post.

    • #193339
      Participant
      Topics: 6
      Replies: 9
      Points: 63
      Rank: Member

      Explaining that you want something from, to perform matches, to determine differences, etc. on columnx and columny has no context. It is much easier for the community to assist you in parsing data if you provide an example of the data and an example of the end result, like the aforementioned post.

      Sorry for making it difficult here is the example.

      Apps                                              Current  Version       Available to Update
      —- ——- ——————-
      Adobe Acrobat Reader DC        19.021.20047             19.021.20058
      Bang & Olufsen Audio                  9.0.212.0                   9.0.212.0

       

      My script show this result listed above I would like to only  App with the version mismatch.

    • #193397
      Participant
      Topics: 5
      Replies: 106
      Points: 273
      Helping Hand
      Rank: Contributor

      How about just filter the $result as

      or you test the version before creating the psobject

    • #193658
      Participant
      Topics: 6
      Replies: 9
      Points: 63
      Rank: Member

       

      That actually works. Glad we have a community like this that look at different angles.

    • #193703
      Participant
      Topics: 15
      Replies: 1761
      Points: 3,167
      Helping Hand
      Rank: Community Hero

      If you are working with versions, you should use the [version] type accelerator, otherwise you are comparing strings and just doing -ne could mean the current version is higher than where you are getting the available version. Here is an example:

      This accelerator also allows you to check specific parts of the version if want to be specific:

    • #193715
      Participant
      Topics: 5
      Replies: 106
      Points: 273
      Helping Hand
      Rank: Contributor

      That version type is a neat trick 🙂 You could define the type in pscustomobject and skip the temp variable

Viewing 8 reply threads
  • The topic ‘Help with Compare CSV and Output only Mismatch’ is closed to new replies.