join and paste command
<p>I have 2 files. </p>

<pre><code>bash-3.2$ cat result2.txt 
HOSTNAME=host4 2 
HOSTNAME=host1 2 
HOSTNAME=host6 1 
HOSTNAME=host3 1 
HOSTNAME=host2 1 

bash-3.2$ cat result1.txt 
HOSTNAME=host1 2 
HOSTNAME=host2 1 

bash-3.2$ cat result.txt 
HOSTNAME=host1 2
HOSTNAME=host2 1
HOSTNAME=host3 1

bash-3.2$ cat result3.txt 
HOSTNAME=host4 3
HOSTNAME=host1 4
HOSTNAME=host3 7
HOSTNAME=host2 8
HOSTNAME=host6 6


bash-3.2$ join -1 1 -2 1 -a 1 -a 1 result2.txt result1.txt 
HOSTNAME=host4 2 
HOSTNAME=host1 2 
HOSTNAME=host6 1 
HOSTNAME=host3 1 
HOSTNAME=host2 1 
</code></pre>

<p>I would like to join 2 files when the order and value of 1st column of both the files are not same.</p>

<p>I want the output to be </p>

<pre><code>hostname       result  result1 result2 result3
HOSTNAME=host1 2       2         2      4
HOSTNAME=host2 1       1         1      8
HOSTNAME=host3 1       0         1      7
HOSTNAME=host4 0       0         2      3
HOSTNAME=host6 0       0         1      6
</code></pre>

<p>Even paste command is not working as it assumes the 1st column of both the files are same. Or is there any other command in bash that i can use for this output</p>