Remove Lines Containing Text
Removes every line that contains a word or phrase you specify, or does the reverse and keeps only those lines. Use it to filter log files, drop comments or unwanted entries from a list, or pick out the lines you care about from a long block of text.
How to use the Remove Lines Containing Text
- Paste your text and type the text to look for in Lines containing.
- Choose Remove matching lines or Keep only matching lines.
- To match several terms, separate them with
|, for exampleerror|warning.
Rules applied
- Matching is plain text, not a pattern, and ignores upper and lower case by default.
- Match whole words only stops cat from matching category.
Limitations
- For pattern matching, test your pattern with the Regex Tester.
Worked examples
Input
INFO started ERROR disk full INFO done Warning: low memory
Result
INFO started INFO done
Input
cat food category black cat
Result
cat food black cat
Practical uses
-
Filtering a log file
A developer has a long pasted log and only cares about problems. They type INFO into Lines containing and choose Remove matching lines. The errors and warnings that remain are much easier to read.
-
Keeping only relevant rows
An analyst pastes a list of order notes and wants only those about one product. They enter the product name and choose Keep only matching lines. The list is reduced to the relevant rows, ready to copy elsewhere.
-
Dropping comment lines
An administrator has a draft with notes to self that should not be shared. They enter a marker such as TODO and remove every line containing it. The cleaned draft can then be sent to others.
Related tools
Privacy: this tool runs entirely in your browser. Your text is not uploaded, logged or saved, and it is never sent to analytics. Maximum input: 1 MiB.