Remove lines containing
Remove every line that contains a word or phrase – or keep only those lines. Multiple terms, whole words, case sensitivity and regex.
Your text is processed in your browser and never sent to our server.
One term per line. A line matches if it contains any of them.
0 characters · 0 words · 0 lines
How to remove lines containing a word
Need to clean a log, a CSV export or a long list? This tool removes every line that contains a given word or phrase – or does the opposite and keeps only the matching lines, like grep.
- Paste your text into the left box.
- Type the words or phrases to look for – one per line. A line matches if it contains any of them.
- Choose whether matching lines should be removed or kept.
- Copy or download the result. The counters show how many lines were removed and kept.
- Remove them / Keep only them – delete the matching lines, or delete everything else.
- Case sensitive –
Errorno longer matchesERROR. Off by default. - Whole words only –
applematches “apple pie” but not “pineapple”. Works with accented letters too. - Regular expressions – each line of the terms box is a JavaScript regular expression, e.g.
^#for comment lines or5\d\d$for HTTP 5xx responses. An invalid pattern is reported instead of breaking the result.
Example
Input – an application log; terms DEBUG and healthcheck, mode “Remove them”:
INFO User Ján logged in DEBUG Cache hit for key user:42 INFO GET /healthcheck 200 ERROR Payment failed for order 1093 DEBUG SQL took 3 ms
Result:
INFO User Ján logged in ERROR Payment failed for order 1093
Switch to “Keep only them” with the term ERROR and you get just the error lines.
Frequently asked questions
How do I remove lines containing a word in Notepad++?
Open Search → Mark, enter the word, tick Bookmark line and click Mark All. Then use Search → Bookmark → Remove Bookmarked Lines. With this tool you skip the bookmarks and can use several words at once.
How do I delete rows containing specific text in Excel or Google Sheets?
In Excel, select the column, use Data → Filter, choose Text Filters → Contains…, select the visible rows and delete them, then clear the filter. In Google Sheets, =FILTER(A:A, NOT(REGEXMATCH(A:A, "word"))) returns the rows without the word. For a quick one-off clean-up, pasting the column here is faster.
How do I keep only the lines that contain a word?
Select Keep only them. It works like grep "word" file.txt, while “Remove them” works like grep -v.
Can I remove empty lines or duplicates at the same time?
Send the result to the empty lines remover or the duplicate remover with the “Send result to…” button. To change text inside lines instead of removing them, use find and replace.
Is my text sent to a server?
No. Filtering happens in your browser, so even confidential logs never leave your computer.