mercredi 29 avril 2015

Diff two files in shell script

Assume we have two files named file1 and file2.

File1:    
a=b    
c=d    
e=f

File2:   
a=p  
c=o  
e=f  
g=h  
i=j  

Here file2 has the same keys of file1 and different values.Apart from some extra key-value pair of its own.

Compare two files keys, replace file2 value with file1 value based on key match. Retain the new entries in file2.

So, my final output should be :

File2: 
a=b  
c=d  
e=f  
g=h  
i=j  

Thanks In Advance.

Aucun commentaire:

Enregistrer un commentaire