 <p>if you want to remove lines that contains words in that blacklist</p> <pre><code>grep -v -f blacklist.txt inputfile &gt; filtered_file.txt </code></pre> <p>if you want to remove just the words alone</p> <pre><code>awk 'FNR==NR{ blacklist[$0] next } { for(i=1;i&lt;=NF;i++){ if ($i in blacklist){ $i="" } } }1' blacklist inputfile &gt; filtered_file.txt </code></pre>