If ReplaceLeftWithRight_where_you_do_not_replace_things.txt
contains pairs of string replacements, where any occurrence of the text in the first column should be replaced by the second column,
1 one
2 two
3 three
four fyra
five fem
then this can trivially be expressed as a sed
script.
s/1/one/g
s/2/two/g
s/3/three/g
s/four/fyra/g
s/five/fem/g
and you can trivially use sed
to create this sed
script:
sed 's%.*%s/&/g%;s% %/%' ReplaceLeftWithRight_where_you_do_not_replace_things.txt
then pass the output of that to a second instance of sed
:
sed 's%.*%s/&/%;s% %/%' ReplaceLeftWithRight_where_you_do_not_replace_things.txt |
sed -f - someFile_Where_You_Replace_Things.txt
to replace all the matches in the file someFile_Where_You_Replace_Things.txt
and have the output printed to standard output.
Sadly, not all sed
dialects support the -f -
option to read a script from standard input, but this should work at least on most Linuxes.
Sorry if I misunderstood your problem statement.