Hi Experts,
I am very new to scripting and have a prb since few days and it is urgent to solve so much appreciated if u help me.
i have 2 files
file1.txt
9647810043118
9647810043126
9647810043155
9647810043161
9647810043166
9647810043185
9647810043200
9647810043203
9647810043250
9647810043277
file2.txt
418200100045528,2100,A,ALL,T11,9647810042955,9647802999956
418200100045549,2100,A,ALL,T11,9647810042976,9647802999956
418200100045652,2100,A,ALL,T11,9647810043081,9647802999956
418200100045665,2100,A,ALL,T11,9647810043094,9647802999956
418200100045688,2100,A,ALL,T11,9647810043118,9647802999956
418200100045696,2301,A,ALL,T11,9647810043126,9647802999978
418200100045724,2100,A,ALL,T11,9647810043155,9647802999956
418200100045730,2100,A,ALL,T11,9647810043161,9647802999956
418200100045735,2100,A,ALL,T11,9647810043166,9647802999977
418200100045754,2301,A,ALL,T11,9647810043185,9647802999956
418200100045769,2100,A,ALL,T11,9647810043200,9647802999938
418200100045772,2100,A,ALL,T11,9647810043203,9647802999902
418200100045817,2100,A,ALL,T11,9647810043250,9647802999902
418200100045844,2100,A,ALL,T11,9647810043277,9647802999902
418200100045851,2100,A,ALL,T11,9647810043284,9647802999981
418200100045886,2100,A,ALL,T11,9647810043320,9647802999938
418200100045912,2301,A,ALL,T11,9647810043356,9647802999980
418200100045946,2100,A,ALL,T11,9647810043393,9647802999938
418200100046067,2100,A,ALL,T11,9647810043515,9647802999904
418200100046068,0,A,ALL,T11,9647810043516,9647802999938
418200100046091,2301,A,ALL,T11,9647810043540,9647802999938
418200100046132,2100,A,ALL,T11,9647810043582,9647802999980
418200100046135,2100,A,ALL,T11,9647810043585,9647802999980
418200100046168,2100,A,ALL,T11,9647810043618,9647802999923
418200100046239,2100,A,ALL,T11,9647810043691,9647802999938
418200100046285,2100,A,ALL,T11,9647810043738,9647802999980
418200100046364,2301,A,ALL,T11,9647810043818,9647802999980
418200100046382,2100,A,ALL,T11,9647810043836,9647802999980
this is just a sample, the original files are much bigger (file1 is 100K records and file 2 is 3750K records)
the result.txt should be:
418200100045688,2100,A,ALL,T11,9647810043118,9647802999956
418200100045696,2301,A,ALL,T11,9647810043126,9647802999978
418200100045724,2100,A,ALL,T11,9647810043155,9647802999956
418200100045730,2100,A,ALL,T11,9647810043161,9647802999956
418200100045735,2100,A,ALL,T11,9647810043166,9647802999977
418200100045754,2301,A,ALL,T11,9647810043185,9647802999956
418200100045769,2100,A,ALL,T11,9647810043200,9647802999938
418200100045772,2100,A,ALL,T11,9647810043203,9647802999902
418200100045817,2100,A,ALL,T11,9647810043250,9647802999902
418200100045844,2100,A,ALL,T11,9647810043277,9647802999902
which is doing matching line in 1st file to the 6th column (, separated) in file2; when matched prints the full line in file2 to a new file
the script i am using is
for line in `awk '{print $1 }' $1`
do
grep $line $2 results_$1
done
but it is taking too long, would any one please help me in this?
Thank you in advance and much appreciated