 <p>You can use awk with 2 files.</p> <pre><code>$&gt; cat file.txt Hi {YOU}, it's {ME} $&gt; cat repl.txt YOU=John ME=Leonardo $&gt; awk -F= 'FNR==NR{a["{" $1 "}"]=$2; next} {for (i in a) gsub(i,a[i])}1' repl.txt file.txt Hi John, it's Leonardo </code></pre> <ul> <li>First <code>awk</code> command goes through replacement file and stores each key-value in an array <code>a</code> be wrapping keys with <code>{</code> and <code>}</code>.</li> <li>In second iteration we just replace each key by value in actual file.</li> </ul> <p><strong>Update:</strong></p> <p>To do this without creating repl.txt you can use `process substitution**:</p> <pre><code>awk -F= 'FNR==NR{a["{" $1 "}"]=$2; next} { for (i in a) gsub(i,a[i])} 1' &lt;(( set -o posix ; set ) | grep -E '^(YOU|ME)=') file.txt </code></pre>