I'm looking for a way to sort a csv file on unique values in 3 columns. In addition to returning the unique data, I also need to know what the non-unique(duplicate) data was so I can report on it(i.e. what was dropped).
$uData below gives me the unique data I'm after –
$data = import-csv $InputFile -header("A","B","C","D","E","F","G") $uData = import-csv $InputFile -header("A","B","C","D","E","F","G") | Sort C,D,E -unique
To find the non-unique I tried a compare, though it is returning data that is unique, not that which was dropped –
compare-object $data $uData -passthru | Select C,D,E | ft
Any thoughts how how I can determine non-unique data in this scenario?
Nevermind, found my issue. It should be –
compare-object $zdata $Data -property C,D,E -passthru | ft
You must be logged in to reply to this topic.