title: How to update line in file when comparing with file2
body: <p>Here is an example of the input files:</p>
  
  <pre>
  FILE1              FILE2
  1,1,1,1,2          6,2,2,2,2
  2,2,1,2,1          1,1,1,1,2
  3,1,2,1,1          5,3,2,1,2
  4,2,1,1,1          8,3,2,5,2
  5,1,2,1,1          2,2,2,2,2
  </pre>
  
  <p>I want it to first remove any lines that is a exact match to the other file. <strong>First line was removed because file 2 already has it, I also have this part of the code already.</strong></p>
  
  <pre>
  FILE1              FILE2
  2,2,1,2,1          6,2,2,2,2
  3,1,2,1,1          1,1,1,1,2
  4,2,1,1,1          5,3,2,1,2
  5,1,2,1,1          8,3,2,5,2
                     2,2,2,2,2
  </pre>
  
  <p>After that I would like to update file 2 with lines that come from file1. The condition for which line to update is the first number. If the first number in the first column matches the first number in file 2 of the first column then it will update the rest of the numbers in the same line. 
  Now the final file will look like this. <strong>The asterisks are to show the changes and this is where I'm stuck at.</strong></p>
  
  <pre>
  FILE1              FILE2
  2,2,1,2,1          6,2,2,2,2
  3,1,2,1,1          1,1,1,1,2
  4,2,1,1,1          *5,1,2,1,1*
  5,1,2,1,1          8,3,2,5,2
                     *2,2,1,2,1*
  </pre>
  
  <p>The only problem that I'm running into at the moment is the last part. I'm not sure how I should be updating the numbers, I was thinking of using a split so we know the first column of numbers and match that with file 2 but I just couldn't figure it out. My code is below.</p>
  
  <pre><code>$ref = Get-Content $file2
  (Get-Content $file1) |
      ? { $ref -notcontains $_ } |
      Set-Content $file1
  
  $content = Get-Content $file1
  (Get-Content $file2 $Column1 = $_.split(',')) |
      ? { $ref -contains $column1} |
      Set-Content $file2
  </code></pre>