I have two csv files, one that contains a list of the MySQL 8.0 reserved keywords and another that contains four randomly chosen reserved keywords as well as test1, test2, test3 and test 4. I want to compare the two csv files, and return results that are present in both files. The test csv file contains first_value, rank, savepoint, shutdown, test1, test2, test3, and test4 screenshot of entries in csv file. For some reason, my script is only returning savepoint and shutdown instead of savepoint, shutdown, rank and first_value. I'm not sure why? I'd appreciate any thoughts!!
Results of script: you can see savepoint and shutdown are present in both in this image
$array_list = @()
foreach($row in (Get-Content C:\ShowStopper\test3.csv)){
$array_list += ($row.split(','))
}
$array_list
$array_list2 = @()
foreach($row in (Get-Content C:\ShowStopper\80.csv)){
$array_list2 += ($row.split(','))
}
$array_list2
Compare-Object -ReferenceObject $array_list2 -DifferenceObject $array_list -IncludeEqual
I also tried a simpler variation, which did not work either.
$objects = @{
ReferenceObject = (Get-Content -Path C:\ShowStopper\test3.csv)
DifferenceObject = (Get-Content -Path C:\ShowStopper\80.csv)
}
Compare-Object @objects -IncludeEqual