Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Comparing two csv's and the columns within

$
0
0

Hi,

I have two csv's which I need to compare.

csv1

col1, col2

1000, 01

1200, 02

1200, 04

1400, 05

1400, 06

...............

csv2

col1, col2

1200, 04

1400, 05

I need to do a comparison between these two csv's such the output is csv 1 - csv 2

so the output should be

col1, col2

1000, 01

1200, 02

1400, 06

So I have a script which would do the following.

$file1 = import-csv -Path "C:\temp\csv1.csv"          
$file2 = import-csv -Path "C:\temp\csv2.csv"  

Compare-Object $file1 $file2 -property col1,col2 -IncludeNotEqual

However it is not giving me the desired results. I would appreciate any help on this.     

Thanks    


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>