I need to do something similar to this post (but with a twist). That is why I ask.
unix shell: replace with dictionary
I have a dictionary (dict.txt). This space is divided, and it reads as follows:
V7 momentum
B6 Quanta p>
....
(the first column is the key, and the second column is the value, in a sense)
I have a user file (user.txt), it contains key entries (V7, B6, etc.). The twist is that the keys are not in their column (therefore, the method in the above record does not apply).
The user file (user.txt) can be viewed as a stream of characters. I just want to replace all occurrences of keys (for example, V7), regardless of whether they are space-limited or limited by another character to the value (Momentum) derived from the dictionary.
For instance:
βWe have V7 as inputβ β should change to β βWe have Momentum as inputβ
"We have something V7_as input" β should change to β "We have something Momentum_as input"
source share