Remove lines containing
Deletes — or keeps — every line that matches a word or pattern.
Type a word, choose how it should match, and either delete every line containing it or throw away everything else. The tool tells you how many lines it removed, which is the quickest way to check you filtered what you thought you did.
Five ways to match
Most tools in this category only offer "contains", and that is the source of a lot of quiet damage. Filtering a list
of files for test with a plain contains match also deletes latest.log and
protest.txt. The modes here exist so you can be precise.
- Contains — the word appears anywhere in the line. The default, and the right choice when you are filtering log output for a keyword.
- Starts with — the line begins with it. Useful for comment markers (
#,//) and for structured data where the first field decides the row type. - Ends with — the line ends with it. File extensions, punctuation, trailing markers.
- Whole word — the word appears surrounded by non-letters. This is what stops
catmatchingcatalogue. It understands letters in any alphabet, so it works on Cyrillic, Greek and accented text rather than only on plain English. - Regular expression — full control.
^\d+for lines starting with a number,(error|fatal)for either word,^\s*$for blank lines.
Matching ignores case unless you tick the box, because most of the time you are looking for a word rather than a specific capitalisation of it.
Remove or keep — the same operation, inverted
These are two sides of one filter, and having both matters. "Remove matching" is how you strip noise: debug lines, comments, a supplier you no longer stock. "Keep only matching" is how you extract signal: every line mentioning an error code, every row for one region, every URL containing a path.
A pattern that is hard to write as "remove everything except X" is often trivial as "keep only X", and vice versa. If you find yourself building a monstrous regex, try the other button.
Typical uses
- Log triage. Keep only lines containing
ERROR, then remove the ones containing a known-harmless warning. Two presses and a 40,000-line log becomes something you can read. - Cleaning exports. Remove header rows repeated throughout a report, or rows for a test account.
- Code and config. Remove lines starting with
#to see what a config file actually sets, once the commentary is gone. - Email and ID lists. Keep only lines containing
@company.comto split internal from external. - Content work. Keep only lines containing a keyword to see every place a term is used across a document.
Doing it without this tool
Notepad++: Search → "Find all in current document", then use "Bookmark all lines" from the Mark dialog and Search → Bookmark → "Remove bookmarked lines". It works and almost nobody remembers the sequence.
VS Code: no built-in filter. The common workaround is Ctrl+Shift+L to select all occurrences, then Home, Shift+Down to select whole lines and delete — which fails on lines with more than one match.
Excel: a helper column with =ISNUMBER(SEARCH("word",A1)), then filter and delete the visible
rows.
Command line: this is what grep is. grep -v word file.txt removes matching lines,
grep word file.txt keeps them, -i ignores case and -w matches whole words. If a
terminal is open, that is faster than any web page.
Runs entirely in your browser. Your text is never uploaded — open DevTools, Network tab, and you will see zero requests while you use this tool.
How to use it
- Paste your text into the box.
- Type the word or pattern you want to match.
- Choose the match mode — use "Whole word" to avoid matching longer words that contain yours.
- Press "Remove matching lines" to delete them, or "Keep only matching lines" to discard everything else.
Related tools
Frequently asked questions
Choose the "Whole word" mode. Searching for cat then matches cat but not catalogue, because the word has to be surrounded by non-letter characters.
Not by default. Tick "Case sensitive" if the capitalisation matters, for example when filtering for an all-caps log level like ERROR while ignoring the word error in messages.
Yes — that is the "Keep only matching lines" button, which is the same filter inverted. Everything without a match is discarded.
Yes, choose "Regular expression" in the match dropdown. Standard JavaScript syntax applies, so ^ and $ anchor to the line and | means or.
After each run the message under the buttons reports how many lines were removed. If the number is unexpected, press Undo and adjust the match mode.