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