Hi,
I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines).
#################################
huge_file.txt
a
a
ab
b
##################################
small_file.txt
a 1.5
b 2.5
ab 7.5
###################################
Script I am using :
BEGIN { cnt=0;
while ( getline line < "small_file.txt" > 0 )
n[++cnt]=line
}
{
for(i=1; i<=cnt; i++)
if(match(n,$0) > 0)
print n
}
####################################
and output I am having :
a 1.5
ab 7.5
a 1.5
ab 7.5
ab 7.5
b 2.5
ab 7.5
####################################
But the desired output is :
a 1.5
a 1.5
ab 7.5
b 2.5
#####################################
I understand that I am getting this output since I am using MATCH function here. But I want exact matches only. can I use some regular expression around $0 or any other better way.
Any help would be highly appreciated.