title: compare columns in two csv files
body: <p>With all of the examples out there you would think I could have found my solution. :-)</p>
  
  <p>Anyway, I have two csv files; one with two columns, one with 4.  I need to compare one column from each one using powershell.  I thought I had it figured out but when I did a compare of my results, it comes back as false when I know it should be true.  Here's what I have so far:</p>
  
  <pre><code> $newemp = Import-Csv -Path "C:\Temp\newemp.csv" -Header login_id, lastname, firstname, other | Select-Object "login_id"
   $ps = Import-Csv -Path "C:\Temp\Emplid_LoginID.csv" | Select-Object "login id"
   If ($newemp -eq $ps)
      {
        write-host "IDs match" -forgroundcolor green
      }
   Else 
      {
        write-host "Not all IDs match" -backgroundcolor yellow -foregroundcolor black
      }
  </code></pre>
  
  <p>I had to specifiy headers for the first file because it doesn't have any.  What's weird is that I can call each variable to see what it holds and they end up with the same info but for some reason still comes up as false. This occurs even if there is only one row (not counting the header row).</p>
  
  <p>I started to parse them as arrays but wasn't quite sure that was the right thing.  What's important is that I compare row1 of the first file with with row1 of the second file.  I can't just do a simple -match or -contains.</p>
  
  <p>EDIT:  One annoying thing is that the variables seem to hold the header row as well.  When I call each one, the header is shown.  But if I call both variables, I only see one header but two rows.</p>
  
  <p>I just added the following check but getting the same results (False for everything):</p>
  
  <pre><code>    $results = Compare-Object -ReferenceObject $newemp -DifferenceObject $ps -PassThru | ForEach-Object { $_.InputObject }
  </code></pre>