Notepad++:删除包含单词 "Correct" 的行及其上方的两行
Notepad++: Remove lines containing the word "Correct" and the two lines above it
我有一个这样的文本文件:
010 2015.06.29 09:57:57.731 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used postadres): DIFFERENT_TEXTS
010 2015.06.29 09:57:58.220 WARN ALWAYS_SAME_TEXT] No tussenpersoon found with the given strings: DIFFERENT_TEXTS
010 2015.06.29 09:57:59.288 WARN ALWAYS_SAME_TEXT] More than one cluster (2) found with the given string: DIFFERENT_TEXTS
010 2015.06.29 09:58:00.192 WARN ALWAYS_SAME_TEXT] More than one cluster (2) found with the given string: DIFFERENT_TEXTS
010 2015.06.29 09:58:02.766 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:02.778 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
010 2015.06.29 09:58:03.647 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:03.659 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
010 2015.06.29 09:58:03.991 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:04.004 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used postadres): DIFFERENT_TEXTS
我想要实现的是删除以下所有行(包含单词 "Correct"):
Correct notaris is found when using the postadres instead of bezoekadres
包括上面两行。所以在上面的例子中,我想删除以下几行:
010 2015.06.29 09:58:02.766 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:02.778 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
010 2015.06.29 09:58:03.647 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:03.659 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
- 注意:
ALWAYS_SAME_TEXT
和 DIFFERENT_TEXTS
被替换为
保密地。如名称所述,ALWAYS_SAME_TEXT
是
始终是同一段文字,并且 DIFFERENT_TEXTS
有
每个日志行的文本不同。
我知道我可以将 Ctrl + F
-> Mark-tab
-> Bookmark line checkbox
-> Mark all
与搜索词 Correct
一起使用,但如何才能我还在包含单词 "Correct"
的行上方标记了所有两行,如果这在 Notepad++ 中甚至可能的话。太多了,无法手工标记。
其实我问错了,我再试一次:
我有一个 .txt
文件,其中的日志行如上例所示,我想删除所有包含单词 Correct
的行以及该行上方的每两行。我更喜欢在 Notepad++ 中执行此操作,但如果有人有简单的复制粘贴文件,我可以 运行 在 Visual Studio
中实现相同的目标,我也可以。
正则表达式:
.*[\r\n]+.*[\r\n]+.*\bCorrect\b.*[\r\n]*
替换字符串:
empty string
我有一个这样的文本文件:
010 2015.06.29 09:57:57.731 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used postadres): DIFFERENT_TEXTS
010 2015.06.29 09:57:58.220 WARN ALWAYS_SAME_TEXT] No tussenpersoon found with the given strings: DIFFERENT_TEXTS
010 2015.06.29 09:57:59.288 WARN ALWAYS_SAME_TEXT] More than one cluster (2) found with the given string: DIFFERENT_TEXTS
010 2015.06.29 09:58:00.192 WARN ALWAYS_SAME_TEXT] More than one cluster (2) found with the given string: DIFFERENT_TEXTS
010 2015.06.29 09:58:02.766 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:02.778 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
010 2015.06.29 09:58:03.647 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:03.659 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
010 2015.06.29 09:58:03.991 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:04.004 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used postadres): DIFFERENT_TEXTS
我想要实现的是删除以下所有行(包含单词 "Correct"):
Correct notaris is found when using the postadres instead of bezoekadres
包括上面两行。所以在上面的例子中,我想删除以下几行:
010 2015.06.29 09:58:02.766 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:02.778 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
010 2015.06.29 09:58:03.647 WARN ALWAYS_SAME_TEXT] No notaris found with the given strings (used bezoekadres): DIFFERENT_TEXTS
Trying to retrieve notaris with postadres instead of bezoekadres
010 2015.06.29 09:58:03.659 WARN ALWAYS_SAME_TEXT] Correct notaris is found when using the postadres instead of bezoekadres
- 注意:
ALWAYS_SAME_TEXT
和DIFFERENT_TEXTS
被替换为 保密地。如名称所述,ALWAYS_SAME_TEXT
是 始终是同一段文字,并且DIFFERENT_TEXTS
有 每个日志行的文本不同。
我知道我可以将 Ctrl + F
-> Mark-tab
-> Bookmark line checkbox
-> Mark all
与搜索词 Correct
一起使用,但如何才能我还在包含单词 "Correct"
的行上方标记了所有两行,如果这在 Notepad++ 中甚至可能的话。太多了,无法手工标记。
其实我问错了,我再试一次:
我有一个 .txt
文件,其中的日志行如上例所示,我想删除所有包含单词 Correct
的行以及该行上方的每两行。我更喜欢在 Notepad++ 中执行此操作,但如果有人有简单的复制粘贴文件,我可以 运行 在 Visual Studio
中实现相同的目标,我也可以。
正则表达式:
.*[\r\n]+.*[\r\n]+.*\bCorrect\b.*[\r\n]*
替换字符串:
empty string