I have 2 files 1.txt and 2.txt
1.txt contains below details
user = 10
user2 = 20
user3 = 30
2.txt contains below details
user = 25MB
user2 = 30MB
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
Desired output
user = 10 25MB
user2 = 20 30MB
user3 = 30 0MB
I am using the command:
awk 'FNR==NR{a[$1$2];next}!($1$2 in a)' 1.txt 2.txt
but not getting the desired output. I am new to shell scripting and looking for full implementation help.
Could you please help me with the syntax and implementation?