I have a dictionary key-values dict.tsv file like this:
key1 value1
key2 value2
key3 value3
And my text.txt file has this:
blah blah asdf saf key2 asd blah key1
blah key1
blah key2
blah key3
How do I get this:
blah blah asdf saf key2/value2 asd blah key1/vaue1
blah key1/value1
blah key2/value2
blah key3/value3
I imagine a function working like this:
lookup-and-replace-with-an-association-list
works like this
M-x lookup-and-replace-with-an-association-list RET
- Input path to
dict.tsv
and use the whole file content for lookup and replace. Or if no file provided, select the content from current highlighted region. - (internally) Parse the content to a association list
dict.list
- Input key regex pattern. If no pattern given, take all the keys in the
dict.list
. - Input replace pattern with value. In my case:
keyX/valueX
. - Optional, maybe a interactive confirmation yes, no or do-all would be nice.