I have 2 big files: the first one (10GB) contains text with occurrencies of keys in a specific format {keyX}
and the second one (3GB) contains the mapping between keys and their values (45 milion entries).
file1:
Lorem ipsum {key1} sit amet, consectetur {key41736928} elit, ...
file2:
{key1} dolor
...
{key41736928} adipiscing
...
Considering the dimension of the second file I can't load all the key-value pairs in memory but I cannot search in the entire second file for every key's occurrence.
How can I substitute all the keys in the first file with the relative values in the second file in a decent amount of time?