Hi,
I have input file whose first column needs(match.txt) to be matched with the first column of the input file with min & max length as defined in match.txt. But conditions are not matching. Please help on the changes in the code below as for multiple enteries in match.txt complete match.txt will be iterated for every line
Inputfile.txt
91560606,9132008926661208,20150501000000,S,MTS_TECHZONE,2470,405899136999995,ZTE_20150501000021.4723_MTPP.SMS,postpaid
915612345,9131689141500399,20150501000005,S,MTS_TECHZONE,2376,405899136999995,ZTE_20150501000021.4723_MTPP.SMS,postpaid
915606061,9131689141847478,20150501000008,S,MTS_TECHZONE,2377,405899136999995,ZTE_20150501000021.4723_MTPP.SMS,postpaid
91512130,9132009153417379,20150501000009,S,MTSCC_UTIBAOUT,2471,405899136999995,ZTE_20150501000021.4723_MTPP.SMS,postpaid
91512131,9131638459315908,20150501000009,S,MTSCC_UTIBAOUT,2A65,405899136999995,ZTE_20150501000021.4723_MTPP.SMS,postpaid
9151213,9131899152971817,20150501000001,S,MTSCC_UTIBAOUT,2A6A,405899136999995,ZTE_20150501000051.4724_MTPP.SMS,postpaid
9156060,9131639136042555,20150501000000,S,MTS_TECHZONE,2A65,405899136999995,ZTE_20150501000051.4724_MTPP.SMS,postpaid
91532320,9131878925486546,20150501000000,S,PHONEYTUNES2,2375,405899136999995,ZTE_20150501000051.4724_MTPP.SMS,postpaid
match.txt
9156,4,10
9151,4,7
91532,5,10
Code
awk -F, 'NR==FNR{SHTMINL[$1]=$2;SHTMAXL[$1]=$3;next}
{
for(i in SHTMINL )
{
if($1 ~ /^(i)/ && length($1) <= SHTMAXL[$i] && length($1) >= SHTMINL[$i] )
print
}
}
' match.txt inputfile.txt