So basically I have a original list of 1500 names with a 4 digit number associated with each name. I have another file which contains 200 of these 1500 names with a new 4 digit
You can generate a sed script from the update field like
sed 's:\(.*AY\)\d\+:/\1/s_.*_&_:' UPDATEFILE > SEDUPDATE.SED
Then run the generated script on the original file like:
sed -f SEDUPDATE.SED ORIGINAL_FILE