📚 General & Other

End-Anchored Matching and What Counts as the End

removes lines ending in . The anchor is precise, which makes it safer than an open substring match — and makes it fail hard when something invisible sits after the text you are matching.

grep -v 'x$' removes lines ending in x. The $ anchor is precise, which makes it safer than an open substring match — and makes it fail hard when something invisible sits after the text you are matching.

The invisible character at the end

A file with Windows line endings has a \r before every \n. Your text ends with .pdf\r, so \.pdf$ matches nothing at all. The filter reports zero removals against a list you can see is full of PDFs. Strip \r first.

Trailing spaces do the same thing and are harder to spot, since nothing renders them.

The dot needs escaping

.pdf$ treats . as any character, so it also matches apdf, 1pdf and -pdf. Write \.pdf$. In practice this rarely bites on real URL lists, but it is wrong, and it becomes wrong in a way that matters as soon as the pattern gets reused somewhere stricter.

Query strings move the end

/report.pdf?v=2 does not end in .pdf. If the input might carry query strings, strip them before extension filtering, or the filter misses precisely the URLs that were tracked.

Try it: Remove Lines Ending With on SeoWolf's Notepad.