Skip to content

Instantly share code, notes, and snippets.

@pipelinedave
Last active May 15, 2020 13:56
Show Gist options
  • Save pipelinedave/8ddba82d220aa019269a808103244c3d to your computer and use it in GitHub Desktop.
Save pipelinedave/8ddba82d220aa019269a808103244c3d to your computer and use it in GitHub Desktop.
powershell / Get duplicates from a csv file
$data = Import-Csv -path .\test.csv
$unique = $data | Select-Object -Unique
$data | Where-Object { $_ -notcontains $unique }
Compare-Object -ReferenceObject $data -DifferenceObject $unique -IncludeEqual | Where-Object { $_.SideIndicator -eq "==" } | Select-Object -ExpandProperty InputObject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment