How to filter pscustomobject on the basis of multiple columnsWhat is the best way to filter a Java Collection?How to concatenate text from multiple rows into a single text string in SQL server?How to output MySQL query results in CSV format?Filtering for empty or NULL names in a querysetlist comprehension vs. lambda + filterPSCustomObject to HashtableHow do I pass multiple parameters into a function in PowerShell?How to design RESTful search/filtering?How do you comment out code in PowerShell?PowerShell PSCustomObject content editing

How to scale a verbatim environment on a minipage?

Write to EXCEL from SQL DB using VBA script

Junior developer struggles: how to communicate with management?

Airbnb - host wants to reduce rooms, can we get refund?

Is Cola "probably the best-known" Latin word in the world? If not, which might it be?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?

Why do money exchangers give different rates to different bills

Feels like I am getting dragged into office politics

Attending a conference where my ex-supervisor and his collaborator are present, should I attend?

Why was the battle set up *outside* Winterfell?

Visa for volunteering in England

CRT Oscilloscope - part of the plot is missing

If Earth is tilted, why is Polaris always above the same spot?

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

Is it the same airport YUL and YMQ in Canada?

Accidentally deleted the "/usr/share" folder

How to back up a running Linode server?

Unidentified items in bicycle tube repair kit

How to reply this mail from potential PhD professor?

How to convert array of objects to single object which has dynamic key in typescript

My ID is expired, can I fly to the Bahamas with my passport

Save terminal output to a txt file

Why is the SNP putting so much emphasis on currency plans?



How to filter pscustomobject on the basis of multiple columns


What is the best way to filter a Java Collection?How to concatenate text from multiple rows into a single text string in SQL server?How to output MySQL query results in CSV format?Filtering for empty or NULL names in a querysetlist comprehension vs. lambda + filterPSCustomObject to HashtableHow do I pass multiple parameters into a function in PowerShell?How to design RESTful search/filtering?How do you comment out code in PowerShell?PowerShell PSCustomObject content editing






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a pscustomobject which i want to remove items from. Every entry contains 3 values separated by a semicolon. The first one is a code, the second one a date, and the third one a description. I would like to make either a new pscustomobject containing only the most up to date ones (marked by *), or filter all the older entries from this object. Any help ?



$allocationData = get-content $Global:costAllocationFile | sort

942200;20170701;Merk & Design
942200;20171106;Merk & Design
942200;20171207;Merk & Design *
942800;20170102;Formule Management
942800;20170327;Formule Management *
943120;20170102;Unit 4
943120;20170911;Unit 4 & retail
943120;20171207;Unit 4
943120;20180402;Unit 4
943120;20180703;Unit 4 *
943300;20170102;Inkoop
943300;20170130;Inkoop
943300;20170717;Inkoop *


edit : I forgot to mention, the descriptions may change over time, explaining my motivation










share|improve this question






























    0















    I have a pscustomobject which i want to remove items from. Every entry contains 3 values separated by a semicolon. The first one is a code, the second one a date, and the third one a description. I would like to make either a new pscustomobject containing only the most up to date ones (marked by *), or filter all the older entries from this object. Any help ?



    $allocationData = get-content $Global:costAllocationFile | sort

    942200;20170701;Merk & Design
    942200;20171106;Merk & Design
    942200;20171207;Merk & Design *
    942800;20170102;Formule Management
    942800;20170327;Formule Management *
    943120;20170102;Unit 4
    943120;20170911;Unit 4 & retail
    943120;20171207;Unit 4
    943120;20180402;Unit 4
    943120;20180703;Unit 4 *
    943300;20170102;Inkoop
    943300;20170130;Inkoop
    943300;20170717;Inkoop *


    edit : I forgot to mention, the descriptions may change over time, explaining my motivation










    share|improve this question


























      0












      0








      0








      I have a pscustomobject which i want to remove items from. Every entry contains 3 values separated by a semicolon. The first one is a code, the second one a date, and the third one a description. I would like to make either a new pscustomobject containing only the most up to date ones (marked by *), or filter all the older entries from this object. Any help ?



      $allocationData = get-content $Global:costAllocationFile | sort

      942200;20170701;Merk & Design
      942200;20171106;Merk & Design
      942200;20171207;Merk & Design *
      942800;20170102;Formule Management
      942800;20170327;Formule Management *
      943120;20170102;Unit 4
      943120;20170911;Unit 4 & retail
      943120;20171207;Unit 4
      943120;20180402;Unit 4
      943120;20180703;Unit 4 *
      943300;20170102;Inkoop
      943300;20170130;Inkoop
      943300;20170717;Inkoop *


      edit : I forgot to mention, the descriptions may change over time, explaining my motivation










      share|improve this question
















      I have a pscustomobject which i want to remove items from. Every entry contains 3 values separated by a semicolon. The first one is a code, the second one a date, and the third one a description. I would like to make either a new pscustomobject containing only the most up to date ones (marked by *), or filter all the older entries from this object. Any help ?



      $allocationData = get-content $Global:costAllocationFile | sort

      942200;20170701;Merk & Design
      942200;20171106;Merk & Design
      942200;20171207;Merk & Design *
      942800;20170102;Formule Management
      942800;20170327;Formule Management *
      943120;20170102;Unit 4
      943120;20170911;Unit 4 & retail
      943120;20171207;Unit 4
      943120;20180402;Unit 4
      943120;20180703;Unit 4 *
      943300;20170102;Inkoop
      943300;20170130;Inkoop
      943300;20170717;Inkoop *


      edit : I forgot to mention, the descriptions may change over time, explaining my motivation







      powershell csv filter pscustomobject






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 21:22









      mklement0

      142k23257294




      142k23257294










      asked Mar 22 at 20:19









      IvoseinIvosein

      93




      93






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Use Import-Csv instead of Get-Content



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description 


          And Group-Object code to then sort by Date inside the group and just select the last one



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description |
          Group-Object Code | Foreach-Object
          $_.Group


          Sample output:



          Code Date Description
          ---- ---- -----------
          942200 20171207 Merk & Design *
          942800 20170327 Formule Management *
          943120 20180703 Unit 4 *
          943300 20170717 Inkoop *





          share|improve this answer























          • dude thanks a lot, this is my answer !

            – Ivosein
            Mar 22 at 20:45











          • @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

            – mklement0
            Mar 22 at 21:26











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307244%2fhow-to-filter-pscustomobject-on-the-basis-of-multiple-columns%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Use Import-Csv instead of Get-Content



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description 


          And Group-Object code to then sort by Date inside the group and just select the last one



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description |
          Group-Object Code | Foreach-Object
          $_.Group


          Sample output:



          Code Date Description
          ---- ---- -----------
          942200 20171207 Merk & Design *
          942800 20170327 Formule Management *
          943120 20180703 Unit 4 *
          943300 20170717 Inkoop *





          share|improve this answer























          • dude thanks a lot, this is my answer !

            – Ivosein
            Mar 22 at 20:45











          • @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

            – mklement0
            Mar 22 at 21:26















          2














          Use Import-Csv instead of Get-Content



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description 


          And Group-Object code to then sort by Date inside the group and just select the last one



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description |
          Group-Object Code | Foreach-Object
          $_.Group


          Sample output:



          Code Date Description
          ---- ---- -----------
          942200 20171207 Merk & Design *
          942800 20170327 Formule Management *
          943120 20180703 Unit 4 *
          943300 20170717 Inkoop *





          share|improve this answer























          • dude thanks a lot, this is my answer !

            – Ivosein
            Mar 22 at 20:45











          • @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

            – mklement0
            Mar 22 at 21:26













          2












          2








          2







          Use Import-Csv instead of Get-Content



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description 


          And Group-Object code to then sort by Date inside the group and just select the last one



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description |
          Group-Object Code | Foreach-Object
          $_.Group


          Sample output:



          Code Date Description
          ---- ---- -----------
          942200 20171207 Merk & Design *
          942800 20170327 Formule Management *
          943120 20180703 Unit 4 *
          943300 20170717 Inkoop *





          share|improve this answer













          Use Import-Csv instead of Get-Content



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description 


          And Group-Object code to then sort by Date inside the group and just select the last one



          Import-Csv $Global:costAllocationFile -Delimiter ';' -Header Code,Date,Description |
          Group-Object Code | Foreach-Object
          $_.Group


          Sample output:



          Code Date Description
          ---- ---- -----------
          942200 20171207 Merk & Design *
          942800 20170327 Formule Management *
          943120 20180703 Unit 4 *
          943300 20170717 Inkoop *






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 at 20:38









          LotPingsLotPings

          21k61633




          21k61633












          • dude thanks a lot, this is my answer !

            – Ivosein
            Mar 22 at 20:45











          • @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

            – mklement0
            Mar 22 at 21:26

















          • dude thanks a lot, this is my answer !

            – Ivosein
            Mar 22 at 20:45











          • @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

            – mklement0
            Mar 22 at 21:26
















          dude thanks a lot, this is my answer !

          – Ivosein
          Mar 22 at 20:45





          dude thanks a lot, this is my answer !

          – Ivosein
          Mar 22 at 20:45













          @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

          – mklement0
          Mar 22 at 21:26





          @Ivosein: Allow me to give you the standard advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting (for which you'll gain 2 reputation points) and up-voting help future readers. See this FAQ for more information.

          – mklement0
          Mar 22 at 21:26



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307244%2fhow-to-filter-pscustomobject-on-the-basis-of-multiple-columns%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript