Thanks Bartus11 for your help in the following code to compare the two files "t1" and "t2".
awk 'NR==FNR{a[$2]=1;next}$2 in a{print $2}' t1 t2
First can anyone explain that what is the purpose of assigning a[$2] =1?
Second, the current script is printing out the matched columns between the first and second file "t1" and "t2" but I want to print out only the ratio of matched columns. In other words, if only on column in matched between �t1� and �t2� then it should print out �1� instead value of the column "real_name".
Can anyone please suggest what kind of amendment is required in the above code to achieve the desired output?
Input: t1
7 real_name
8 pa_name
9 make_server_info_pw
9 passon
11 mapped_name
11 nt_status
13 passon
15 p
17 server_info
18 p
Input t2:
1 CHECK_DECLS
1 True
1 conf
1 headers
1 reverse
1 real_name
Current output:
real_name
Desired output:
1