Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remove all duplicates in CSV file

$
0
0

Hi, i have a csv file which i want to remove all duplicates from 1 column.

For example $csv

user          id

----          -------

user1      1

user2      2

user2      3

user3      4

I want to remove duplicates so at the end i end up with

user          id

----          -------

user1      1

user3      4

I got an answer here like:

$user = "user1","user2","user2","user3"
$user | Group-Object | Where-Object { $_.Count -eq 1 } | Select-Object -ExpandProperty Group

But it only works when there is 1 column...

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>