powershell - Add a CSV content to another CSV -
i have 2 csv files, both have same header:
id,relation,first name,last name,email address,office,phone,photos
i'm trying make powershell scrip copy 2nd csv file @ end of first, without header.
is there way eliminate duplicate records based on column, after added 2 together?
you can use group-object
cmdlet group records on specific (or multiple) column. iterate on list using foreach-object
, select first entry in each group give distinct list. can export csv using export-csv
cmdlet:
import-csv "your-csv.path" | group -property 'id' | foreach-object { $_.group | select -first 1} | export-csv -path 'your_csv.path'
Comments
Post a Comment