Notepad++ uses regular expressions to batch delete rows containing keywords

To delete rows containing keywords in batches, syntax:

^.*关键字.*\r?\n    (不保留空行)
^.*关键字.*$  (保留空行)

I want to use the search function in Notepad++ to find the line containing the field "0|20180706" in the file and delete it.

Specific steps:

1.Ctrl + F, search, select 'regular expression' for search mode, uncheck '.Match new lines'
2. Search target input ^. 0|20180706. \r?\n (If you want to keep empty lines, search ^. 0|20180706. $)
3. Replace with: (empty)

Notice:

Notepad++'s [Replace All] is constrained by [Direction], so if you want to replace all "downward", you must put the cursor at the beginning of the text.
The matching field has "|", so the "|" character needs to be escaped through a backslash . Otherwise, all rows containing "0" or "20180706" fields will be matched.

scenes to be used:

  1. Enter the core/res/res directory and export all directories through the command ll |tee log.txt

  2. notepad++ opens the log.txt file and deletes all lines containing the "mcc" keyword, statement: ^. mcc. \r?\n

Insert image description here
Specific grammar rules can be googled by yourself

Guess you like

Origin blog.csdn.net/qq_34591972/article/details/132710724