Hi folks,
I have three text files (some output logs, lets name them for example: log1.txt, log2.txt and log3.txt, every row in every file begins with: "\" and ends with: ";". These files have a lot of same lines).
Now the fun part starts, I need to compare these three files and delete the same lines in each one. So in the end there are 3 text files with only different rows. Here is my code so far, but I´m new to PS so it´s not much and it´s not doing the thing I want...
compare-object (get-content log1.txt) (get-content log2.txt) > temp_a.txt
compare-object (get-content log1.txt) (get-content log3.txt) > temp_b.txt
compare-object (get-content log2.txt) (get-content log3.txt) > temp_c.txt
New-Item -ItemType file ".\output.txt" –force
Get-Content .\temp_a.txt | Add-Content .\output.txt
Get-Content .\temp_b.txt | Add-Content .\output.txt
Get-Content .\temp_c.txt | Add-Content .\output.txt
I would be glad for any help or suggestions. I thought of taking one line at a time and compare it with file 2 and then 3 and if it´s the same in all 3 files then I can delete it in every file and move to next line. But don´t know how to code it...