Speeding up comparision of two CSV file imports

Why don’t you start with something easier to understand? :wink: :smiley:

$A = import-csv c:\data\file1.csv 
$B = import-csv c:\data\file2.csv | Select-Object -Property *, @{Name = 'Name'; Expression = { $_.'here you should provide the property you want to compare' }}

Compare-Object -ReferenceObject $A -DifferenceObject $B -Property Name -IncludeEqual -PassThru

Assumed you have the data set with the property to compare with the name “Name” in the CSV file “file1.csv” and the data set with the property to compare with a different name in the CSV file “file2.csv” you should provide the name of the property you want to use in the calculated property.

Depending on the result you expect you may play a little bit with the Compare-Object command. Switch the valuers for -ReferenceObejct and -DifferenceObejct for example.

1 Like