PoshCode Archive  Artifact [e320bf197b]

Artifact e320bf197b170f81c1f24912bd610fa021459f236607e6646c26809850cfaaa6:

  • File A-Compare-Object-Bug.ps1 — part of check-in [3085368cc1] at 2018-06-10 12:56:22 on branch trunk — Demo for unexpected output of Compare-Object (user: unknown size: 1935)

# encoding: ascii
# api: powershell
# title: A Compare-Object Bug
# description: Demo for unexpected output of Compare-Object
# version: 0.1
# license: CC0
# x-poshcode-id: 1069
# x-archived: 2009-05-04T20:22:06
#
#
# I want do demonstrate a Compare-object bug
# Bernd Kriszio - http://pauerschell.blogspot.com/ 
 
1, 2, 3, 4, 5 > .\textfile_a.txt
1, 2, 4, 5, 6 > .\textfile_b.txt
cat .\textfile_a.txt
cat .\textfile_b.txt
compare-object (gc .\textfile_a.txt) (gc .\textfile_b.txt) -inc
<#yields
InputObject                                SideIndicator                             
-----------                                -------------                             
1                                          ==                                        
2                                          ==                                        
4                                          ==                                        
5                                          ==                                        
6                                          =>                                        
3                                          <=                                        

I think it has to be
InputObject                                SideIndicator                             
-----------                                -------------                             
1                                          ==                                        
2                                          ==                                        
3                                          <=                                        
4                                          ==                                        
5                                          ==                                        
6                                          =>                                        
#>