How to combine multiple CSV files by the matching contents

28 Views Asked by At

I have two csv. first one is for PC info.(pcinfo.csv)

enter image description here

R1234 has two PCs

Second one is for User-mail info(mail.csv)

enter image description here

R9876 has no mail address

I want to make master CSV based on User ID like as below;

enter image description here

$doc1 = import-csv c:\pcinfo.csv

$doc2 = import-csv c:\mail.csv

$outfile = import-csv c:\mail.csv

Compare-Object $doc1 $doc2 -Property ID -passthru | Where-Object{$_.SideIndicator -eq "=>"} | Select PCname, ID, Mail | Export-csv "c:\complete.csv" -NoTypeInfo

And it did not work properly

0

There are 0 best solutions below