Most SEO data work starts with a list that is too big: thousands of keywords, URLs from a full crawl, a backlink export with every linking page on the web. The first job is almost always to keep only the lines that matter β one site section, one modifier group, one URL pattern.
This guide covers SeoWolf's "keep lines" filters: what each one matches, where they mislead you, and the real workflows they speed up. Pair it with the companion guide to removing lines from SEO lists β keeping and removing are two sides of the same filtering problem.
The Tools at a Glance
| Tool | Use it to |
|---|---|
| Keep Lines Containing | This keeps every line where the specified text appears anywhere and discards the rest. |
| Keep Lines Starting With | This retains lines beginning with the text you specify and discards the rest. |
| Keep Lines Ending With | This keeps lines finishing with the specified text and discards everything else, matching only at the end of each line. |
| Keep Lines Matching Regex | This is the inverse of pattern-based removal: lines matching the expression are kept and everything else is discarded. |
| Keep Lines With Digits | This retains every line with a numeric character somewhere in it and discards the rest. |
Keep Lines Containing
What It Does
This keeps every line where the specified text appears anywhere and discards the rest.
A filter, not a search
Searching shows you matches while leaving the list intact. This produces a new, smaller list containing only the matches, ready for the next operation.
Where it is used
Pulling every URL under a directory, every keyword containing a product name, or every row mentioning a competitor.
Chain filters to narrow further
Applying several keep filters in sequence progressively narrows a list. Each pass is simple and independently verifiable, which is easier to reason about than one complex expression.
Fixed-String Matching Beats Regex for Literal Terms
grep 'term' treats the pattern as a regular expression. grep -F 'term' treats it as a literal string, and for literal terms the second is both safer and faster.
Metacharacters in your search term
A term containing ., +, ?, ( or [ is a pattern, not a literal, under default grep. Searching for v1.2 also matches v1x2. Searching for c++ is a syntax error in extended mode. -F removes the entire class of problem.
Speed on large inputs
Fixed-string matching uses algorithms that skip ahead through the input rather than testing every position. On multi-gigabyte files the difference is substantial.
Multiple terms at once
grep -F -f terms.txt input.txt keeps lines matching any of the fixed strings in a file, one per line. That is the efficient way to filter a large list against a large term set β far better than looping the filter once per term, which rereads the input every time.
In a Real Workflow: Sizing a Keyword Opportunity Before You Pitch It
Someone asks whether there is enough search demand around a product line to justify a content programme. The answer needs a number, and it needs it today.
Filtering to the theme
Take the full keyword export and keep only the rows containing the product term and its common synonyms. The surviving set is the addressable demand for that theme.
Summing volume, with a caveat
Total the volume across the filtered set for a headline figure, but present it as a ceiling rather than a forecast. Nobody captures all of it, and a proposal built on the assumption that they will is a proposal that fails.
Filter for intent as well as topic
Within the theme, filtering again for commercial modifiers β buy, price, best, vs β separates the terms likely to convert from the ones likely to inform. Those two piles justify different content and different expectations.
Try it: Keep Lines Containing on SeoWolf's Notepad.
Keep Lines Starting With
What It Does
This retains lines beginning with the text you specify and discards the rest.
Why the start position is useful
Structure lives at the beginning of many values. URL paths start with their section, product codes with their category prefix, log lines with their level or timestamp.
The main use
Isolating a site section from a URL list. Keeping lines starting with /blog/ gives exactly the blog, with no risk of matching the word elsewhere in a path.
More precise than an open search
Anchoring to the start removes the false matches that an unanchored search would collect from the middle of longer values.
Prefix Matching Is the Cheapest Filter Available
grep '^/blog/' keeps lines starting with that path. Prefix matching is the most efficient string filter there is, and it has a couple of properties worth exploiting.
No backtracking, ever
An anchored literal prefix compares a fixed number of characters at a known position and stops. There is no scanning and no backtracking, so performance is constant per line regardless of line length. On very large inputs the difference against an unanchored search is substantial.
startsWith beats regex
Most languages have a direct prefix comparison. It avoids the regex engine entirely and cannot be confused by metacharacters in the prefix β a path containing . or + needs no escaping.
Sorted data allows binary search
If the input is sorted, all lines sharing a prefix are contiguous. look exploits this directly, and the same idea underlies prefix indexes in databases: a LIKE 'abc%' query can use an index while LIKE '%abc%' cannot, for exactly this reason.
In a Real Workflow: Reporting on One Section Without Rebuilding the Crawl
The question is about the blog. The data covers the whole site. Re-crawling just the blog wastes an hour that filtering solves in seconds.
Filtering to the section
Keep the lines starting with the section path. The full crawl becomes a section crawl, and the same export answers questions about any section on demand.
Section-level metrics are the actionable ones
Site-wide averages are almost never useful, because sections differ so much. Separating them shows which template has the problem, and a template fix applies to every page using it.
Keep the original export
One crawl filtered several ways answers more questions than several crawls, and the numbers stay comparable because they all come from the same snapshot. Comparing sections crawled on different days introduces differences that have nothing to do with the sections.
Try it: Keep Lines Starting With on SeoWolf's Notepad.
Keep Lines Ending With
What It Does
This keeps lines finishing with the specified text and discards everything else, matching only at the end of each line.
Why the end position matters
Meaningful markers frequently sit at the end of a value: file extensions, trailing slashes, currency codes, status suffixes. Anchoring there avoids matching the same characters elsewhere in the line.
The most common use
Isolating one file type from a mixed URL list β every PDF, every image, every feed.
The inverse
Removing lines by their ending is the same filter in the opposite direction, and which one to use depends only on whether the target set is the smaller one.
Suffix Matching Is Cheaper Than It Looks
grep '\.pdf$' keeps lines ending in .pdf. There are two implementation notes worth having.
The invisible carriage return
A file with Windows line endings has \r before every \n, so no line ends with .pdf β it ends with .pdf\r. The filter returns nothing against data you can plainly see contains PDFs. This is the single most common cause of a suffix filter that "does not work". Strip \r first.
Suffix checks do not need regex
Most languages have endsWith, which is a direct comparison against the tail of the string. It is faster than a regex engine, and it cannot be confused by metacharacters in the suffix β no escaping the dot, no accidental wildcard.
Case sensitivity in file extensions
URLs may carry .PDF as readily as .pdf. Filesystems vary in whether they care; your filter should be explicit either way rather than inheriting a default.
In a Real Workflow: Auditing the PDFs Nobody Remembers Publishing
Most sites accumulate PDFs β old price lists, brochures, whitepapers, forms β and most organisations have no inventory of them. They are indexable, they rank, and they are invisible in a CMS page list.
Finding them
Filter a crawl export to lines ending in .pdf. The result is usually longer than anyone expects and contains documents from several years ago.
Why they matter
A PDF that ranks is a page representing the organisation with no navigation, no calls to action, and frequently outdated pricing or claims. Some of them attract meaningful traffic, and a few attract links.
Deciding what to do
The ones with traffic or links deserve either an updated replacement or an HTML equivalent that can convert. Genuinely obsolete documents should be removed and redirected, not left to rank quietly with information the organisation no longer stands behind.
Try it: Keep Lines Ending With on SeoWolf's Notepad.
Keep Lines Matching Regex
What It Does
This is the inverse of pattern-based removal: lines matching the expression are kept and everything else is discarded.
Choosing the direction
Keep when the wanted set is smaller or easier to describe than the unwanted one. Remove when the opposite is true. Describing the smaller set produces a simpler, safer pattern.
Typical use
Isolating all URLs under a directory, all keywords containing a number, or all rows whose identifier follows a particular format.
Verify by counting
Compare the line count before and after. If the kept set is far larger or smaller than expected, the pattern is matching something you did not intend.
Anchoring, Alternation, and Testing a Keep Filter
A keep filter is grep without -v. Its failure mode is worse than a remove filter's: over-matching in a remove filter leaves you with too little data and you notice, while under-matching in a keep filter silently discards rows you needed.
Anchor the pattern
An unanchored /blog/ matches /archive/blog/ and /not-a-blog/post. Anchor with ^ where the position is known β ^/blog/ is unambiguous and cannot match mid-path.
Alternation needs grouping
^/blog/|/news/ does not mean what it looks like. Alternation has the lowest precedence, so this reads as (^/blog/) or (/news/) β the anchor applies only to the first branch. Write ^(/blog/|/news/) with explicit grouping.
Always diff, never trust
Run the inverse filter as well and inspect what was discarded. The rows you did not expect to lose are where the pattern is wrong, and they only ever surface if you look at them deliberately.
In a Real Workflow: Isolating One Site Section From a Whole-Site Crawl
A crawl covers the entire site. The question is only about the blog, or only about product pages, and everything else is noise obscuring the answer.
Narrowing to the section
Keep only the URLs matching the section's path pattern. Forty thousand rows become the four thousand that the question is actually about.
Why sections need separate analysis
Site-wide averages hide the problems worth finding. A site averaging a 2-second load time might have a blog at 1.1 seconds and product pages at 4.8. The average is a number nobody can act on; the split is a priority.
Compare sections rather than pages
Once each section is isolated, the same metric across sections shows where effort belongs. That comparison consistently produces clearer decisions than ranking individual pages, because sections usually share a template and a template fix is one job for thousands of pages.
Try it: Keep Lines Matching Regex on SeoWolf's Notepad.
Keep Lines With Digits
What It Does
This retains every line with a numeric character somewhere in it and discards the rest.
What digits usually mark
Model numbers, years, sizes, quantities, versions, prices. In a keyword list, a digit frequently signals a more specific and more commercial search than the same phrase without one.
Isolating specific intent
Filtering to numeric terms extracts the part of a keyword set where searchers already know what they want β a size, a model, a year. Those terms convert differently from general research queries.
The complement
Removing lines with digits gives the other half. Both halves are useful; they simply support different content.
Digit Filtering Catches More Than Numbers
grep '[0-9]' keeps lines containing an ASCII digit. On real marketing data it also catches a lot you did not intend.
URLs are full of incidental digits
Percent-encoding, port numbers, dates in paths and IDs in query strings all contain digits. Filtering a URL list for numeric content returns nearly all of it, which is not a filter at all.
Non-ASCII numerals
\d in a Unicode-aware engine matches Devanagari, Arabic-Indic and other numeral systems; a literal [0-9] does not. Full-width digits from CJK sources look identical to ASCII ones and match neither unless normalised to NFKC first.
Match position and quantity
If the requirement is "a four-digit year", write [0-9]{4} with boundaries rather than testing for any digit. If it is "purely numeric", anchor the whole line as ^[0-9]+$. The vague version and the precise version return very different sets, and only one of them answers the question.
In a Real Workflow: Finding the Year-Stamped Keywords You Need to Refresh
Searches carrying a year β best crm 2026, seo trends 2026 β are a recurring, predictable opportunity, and one most content programmes handle badly.
Auditing what you have
Filter your ranking keywords to those containing a digit, then look at which years appear. Pages still ranking for a year two behind the current one are actively signalling that they are out of date, in the search result itself.
Refresh rather than republish
Update the existing page and its title rather than publishing a new one each year. A new page starts from nothing; the existing one carries its links and history. Publishing annually also creates a set of near-identical pages competing with each other.
Plan the timing
Demand for next year's version begins climbing months before the year turns. Refreshing in the last quarter captures that early demand, and updating in February means missing most of it.
Try it: Keep Lines With Digits on SeoWolf's Notepad.
The Bottom Line
Filtering is only as good as the pattern. Check a sample of what was kept and what was dropped, watch for case sensitivity and partial matches, and save the patterns that work so the next export takes seconds instead of an afternoon.
Next step: All of these tools are free in SeoWolf's Notepad β paste a list and transform it in your browser.