Comparing string in 2 files and appending the data in shell script
<p>I have 2 files 1.txt and 2.txt</p>

<p>1.txt contains below details</p>

<pre><code>user = 10
user2 = 20
user3 = 30
</code></pre>

<p>2.txt contains below details</p>

<pre><code>user = 25MB
user2 = 30MB
</code></pre>

<p>I need to compare both the files if the string matches in the files it should append the data from 1st file and if it does not match it should append 0 in shell script</p>

<p>Desired output</p>

<pre><code>user = 10 25MB
user2 = 20 30MB
user3 = 30 0MB
</code></pre>

<p>I am using the command:</p>

<pre><code>awk 'FNR==NR{a[$1$2];next}!($1$2 in a)' 1.txt 2.txt
</code></pre>

<p>but not getting the desired output. I am new to shell scripting and looking for full implementation help.</p>

<p>Could you please help me with the syntax and implementation?</p>