Select like object properties in Import-Csv loop

Hello friends,

I have a csv file like the following:

Time,ID,User 1/1/2017 1:00:00 PM,1,Bob 1/1/2017 1:01:00 PM,1,Bob 1/1/2017 1:02:00 PM,1,Bob 1/1/2017 1:03:00 PM,1,Bob 1/1/2017 2:00:00 PM,2,Joe 1/1/2017 2:01:00 PM,2,Joe 1/1/2017 2:02:00 PM,2,Joe 1/1/2017 2:03:00 PM,2,Joe 1/1/2017 3:00:00 PM,3,Sue 1/1/2017 3:01:00 PM,3,Sue 1/1/2017 3:02:00 PM,3,Sue 1/1/2017 3:03:00 PM,3,Sue 

I would like to use Import-Csv to loop through all lines, select all objects with the same ID, and determine the time duration in minutes.

I would then use Export-Csv to output like so:

TotalMinutes,ID,User 3,1,Bob 3,2,Joe 3,3,Sue 

I’m stuck on selecting all objects with the same ID.

Any pointers would be greatly appreciated.

Thanks!

submitted by /u/KittenBoner99
[link] [comments]

Leave a Reply