[grep] Show only lines that do not match

Created on November 30, 2026

Use -v, or --invert-match, to select lines that do not match the pattern. This example keeps the line that does not contain apple.

printf 'apple\nbanana\napple pie\n' | grep -v apple
banana
grep Shell command