I have 2 simple text files that I need to compare and output the items that are in BOTH files
Archive.TXT
10000
10001
10002
10003
10005
10010
10011
Active-Job-List.TXT
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
This will give me an output
$File1 = Get-Content C:\Archive-List.txt
$File2 = Get-Content C:\Active-Job-List.txt
Compare-Object -ReferenceObject $File1 -DifferenceObject $File2 -IncludeEqual -ExcludeDifferent | Select @{Expression={$_.InputObject}} | Set-Content C:\Diff.txt
of this in the Diff.txt
@{$_.InputObject=10000}
@{$_.InputObject=10001}
@{$_.InputObject=10002}
@{$_.InputObject=10003}
@{$_.InputObject=10005}
@{$_.InputObject=10010}
@{$_.InputObject=10011}
But what I am really looking for is an output of this
10000
10001
10002
10003
10005
10010
10011
How can I filter the results to what I want? Should I Get-Content
of the Diff.txt and "trim" out things I don't want or is there a simpler way?