title: How to remove lines containing any one of many possible matches with grep?
body: <p>I am using <code>grep -v "cat" input.txt &gt; output.txt</code> to remove all lines in <code>input.txt</code> containing "cat" and outputing the result in <code>output.txt</code>. How can I remove all lines containing "cat" and/or "dog" and/or "fish" and/or "sheep"? This works, but requires many lines:</p>
  
  <pre><code>grep -v "cat" input.txt &gt; output.txt
  mv output.txt input.txt
  grep -v "dog" input.txt &gt; output.txt
  mv output.txt input.txt
  grep -v "fish" input.txt &gt; output.txt
  mv output.txt input.txt
  grep -v "sheep" input.txt &gt; output.txt
  mv output.txt input.txt
  </code></pre>
  
  <p>I tried this `grep -v [cat|dog|fish|sheep] input.txt > output.txt, but that did not work.</p>
  
  <p>How can I remove any line containing at least one of these items?</p>