๐Ÿ“š General & Other

Substring Filtering and the Accidental Match

removes matching lines. The risk is not the mechanism; it is that substring matching has no concept of word boundaries.

grep -v 'term' removes matching lines. The risk is not the mechanism; it is that substring matching has no concept of word boundaries.

The classic over-match

Filtering out cat also removes category, catalogue, education and communicate. On a URL list, removing /tag/ is safe, but removing tag alone takes /vintage/ and /heritage/ with it. The lines vanish silently โ€” nothing reports what was collateral damage.

Anchoring the match

grep -vw matches whole words only. For paths, include the delimiters in the pattern โ€” filter on /tag/ rather than tag. Making the pattern more specific is nearly always the right fix.

Case sensitivity cuts both ways

grep -v is case-sensitive, so filtering Brand leaves brand untouched. Adding -i fixes that and simultaneously widens the over-match problem. Check the count before and after: if the number of removed lines is far from what you expected, the pattern is wrong in one direction or the other.

Try it: Remove Lines Containing on SeoWolf's Notepad.