Package ZenStatus :: Module intersect
[hide private]
[frames] | no frames]

Source Code for Module ZenStatus.intersect

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13  import sys 
14   
15  x = open(sys.argv[1]) 
16  y = open(sys.argv[2]) 
17   
18  inX = x.readlines() 
19  inY = y.readlines() 
20   
21  interX = {} 
22  interY = {} 
23   
24  for item in inX: 
25          interX[item] = 1 
26  for item in inY: 
27          if interX.has_key(item): 
28                  del interX[item] 
29   
30  for item in inY: 
31          interY[item] = 1 
32  for item in inX: 
33          if interY.has_key(item): 
34                  del interY[item] 
35   
36  print "Items in %s not in %s" % (sys.argv[1],sys.argv[2]) 
37  for item in interX.keys(): 
38          print item[:-1] 
39   
40  print "Items in %s not in %s" % (sys.argv[2],sys.argv[1]) 
41  for item in interY.keys(): 
42          print item[:-1] 
43