About this line filter
Cleaning a log, a list of URLs, or an export often comes down to dropping every line that mentions something, or keeping only the lines that do. This tool does both. Choose Remove matching lines to delete them, or Keep matching lines to throw away the rest, then say how to match: anywhere in the line, as a whole word, at the start, at the end, or with a regular expression. Matching ignores case unless you tick the option. You see how many lines matched, how many were kept, and how many were removed.
How to remove lines containing a word
- Paste your text. Put your lines in the box, or press an example, which also fills in the options.
- Say what to match. Type the word or pattern in Text or pattern to match, then choose a Match mode.
- Choose the action. Pick Remove matching lines or Keep matching lines, and tick Case-sensitive matching if capitals matter.
- Press Filter lines. Copy or download the filtered text and check the counts of matching, kept, and removed lines.
Frequently asked questions
What is the difference between Contains and Whole word?
Contains matches the text anywhere, so cat also matches concatenate. Whole word only matches when the text is not part of a longer word, so cat matches "the cat sat" but not "concatenate".
How do I use a regular expression?
Choose Regular expression and write the pattern without slashes, for example ^\d{4}-\d{2} to match lines that start with a date. It uses JavaScript regex syntax, and an invalid pattern shows an error instead of a result.
Are special characters treated literally?
Yes, in every mode except Regular expression. Characters such as the dot, plus sign, and brackets are matched as plain text, so you can search for a.b or [draft] without escaping them.
Can I remove lines that contain one of several words?
Use Regular expression with an alternation, for example error|warning|fatal, to match any of them in one pass. Add ^ and $ around the group to match whole lines.
What happens to blank lines?
They do not contain the pattern, so Remove matching lines keeps them and Keep matching lines drops them. Remove empty lines first with a separate tool if you want them gone.