Powershell: CSV – How to select distinct unique values from a column

Want to quickly display unique values from a column in a CSV file but also want to skip over the first few header rows?

Powershell code:

Get-Content C:\Users\jared\Documents\file.csv | select -skip 6 | ConvertFrom-Csv -Header ‘COL1’, ‘COL2’, ‘COL3’ | select ‘COL2’ |sort ‘COL2’ -Unique | Group-Object -Property ‘COL2’ | select name

This entry was posted in Programming. Bookmark the permalink.