Fastest way to grep list 1000 reocrds in another million of records in a file in linux : Fastest way to grep list 1000 reocrds  in another million of records in a file in linux . 

Let's say these are my sample records :

1,,EE1,1000,WAT,EEE,20160222T02:00:15+0400,20181231T23:59:59+0400,,vEEE,,47126469f184fee9a80664d952d7fea7,50278774602,95223904,140495221530736,21001,,,,,,,,,,,,,,,C

0,,EE1,1000,WAT,EEE,20160222T02:00:15+0400,20181231T23:59:59+0400,20160222T02:00:15+0400,,vEEE,47126469f184fee9a80664d952d7fea7,50278774602,,,21001,,,,,,,,,,,,,,,H

1,,EE1,1000,WAT,EEE,20160222T02:00:15+0400,20181231T23:59:59+0400,20160521T11:07:25+0400,,vEEE,47126469f184fee9a80664d952d7fea7,50278774602,0095223904,140495221530736,21001,,,,,,,,,,,,,,,H


If i grep 50278774602 the values will come in three rows. I have developed one script using for loop on the same , i have a list to such numbers in a file and i am searching the value in the big file (millions of row) and i need only the last occurrence of such row containing my grep pattern , it works perfectly with for loop but my concern is its taking huge time .

My script : 

for i in `cat /home/admin/pnd_tmp`; do grep $i /test/done/TEST_RT* | tail -1 > /home/admin/pnd_fin | awk -F "," '{if ( $1 == "4" ) print $13 }' > /home/admin/pnd_tmp_fin; done 




Can anyone write me a simple script to find in a quickest time . 