Replace All Lines That Do Not Contain Matched String
<p>I'm working with this file of data that looks like this:</p>

<pre><code>text in file
hello random text in file
example text in file
words in file hello
more words in file
hello text in file can be
more text in file
</code></pre>

<p>I'm trying to replace all lines that do <em>not</em> contain the string <code>hello</code> with <code>match</code> using sed, so the output would be:</p>

<pre><code>match
hello random text in file
match
words in file hello
match
hello text in file can be
match
</code></pre>

<p>I tried using <code>sed '/hello/!d'</code> but that deletes the line. Also, I read that I can match using <code>!</code> within sed but I'm not sure how to match every line and replace properly. If you could give me some direction, I would really appreciate it.</p>