Do you have to have the data separated into two files?
It would be much simpler, if you had all the data in one file, using this format: <placeholder>,<replacement>
So it would look like
aaa,1
bbb,2
ccc,3
If any of your data uses a comma, then you can choose any character that you are not using, including a TAB character.
Let us know if this will work for you, and then I'll build an example macro for you.
Here's a barebones example macro that performs the find and replace directly in KM rather than in Sublime Text using the <placeholder>,<replacement> format (make sure to change the paths to the files to the appropriate ones on your own system):
I'm sure that @JMichaelTX's example macro will be much more comprehensive and instructional than this, but in the meantime, hopefully this will get you started. If you have any questions, feel free to ask.
Nope, you did a great job, @gglick. I don't see anything I would do different for small files.
If the target file to be changed is large, then it might be better to open the file once, get the contents, make all the changes, then write back out to the file, as opposed to opening/reading/changing/writing the file for each change.