Delete text rows using regular expressions
by flandersen
Posted on February 20, 2019
This tip is useful if you work with text files (e.g. log files, CSV files …) and want to delete rows containing specific keywords or patterns. Using any program that supports Regular Expressions (short regex) makes this job pretty easy.
Delete rows containing keyword/pattern:
Delete rows NOT containing keyword/pattern:
Read more for an example with Notepad++.
- Start Notepad++.
- Load file to be edited.
- Press
CTRL + F
to open the “Replace” dialog. - Configure dialog as shown below and click “Replace all”.
If something went wrong, Notepad++ lets you undo action with CTRL + Z
.
Previous article