[英]is it possible to loop lines in notepad++?
I have a txt file with patterned content: 我有一个带有图案内容的txt文件:
Line 1 id=1234
Line 2 id=0001
Line 3 id=4321
Line 4 id=9281
Line 5 id=6631
Line 6 id=1234
Line 7 id=1234
Line 8 id=4321
Line 9 id=7772
Line 10 id=0001
... up to Line 5000 id=6631
I want to replace all repetitive contents (ie. Line 1, 6, 7) to only for the first occur. 我想将所有重复内容(即第1,6,7行)替换为第一次出现。 of content (Line 1 id=1234; 6, 7 removed).
内容(第1行id = 1234; 6,7删除)。 In other words, content id of a line must occur once.
换句话说,行的内容id必须出现一次。 Is that possible though regular expressions?
这可能是正则表达式吗?
Assuming that a line would literally read Line 1 id=1234
: 假设一行按字面意思读取
Line 1 id=1234
:
(Line [0-9]+ id=)([0-9]+)(.*?)(Line [0-9]+ id=)\\2\\n
into the find box, and \\1\\2\\3
into the replace with box. (Line [0-9]+ id=)([0-9]+)(.*?)(Line [0-9]+ id=)\\2\\n
,并输入\\1\\2\\3
进入更换盒子。 Regular Expression
is selected and . matches newline
Regular Expression
. matches newline
. matches newline
is checked. . matches newline
被检查。 Replace All
, until all duplicates are removed. Replace All
,直到删除所有重复项。 Replace All: 0 occurrence was replaced.
Replace All: 0 occurrence was replaced.
when it's complete. Assuming instead that the lines would read only id=1234
: 假设这些行只读取
id=1234
:
(id=[0-9]+)(.*?)\\1\\n
into the find box, and \\1\\2
into the replace with box. (id=[0-9]+)(.*?)\\1\\n
,在替换为框中输入\\1\\2
。 Regular Expression
is selected and . matches newline
Regular Expression
. matches newline
. matches newline
is checked. . matches newline
被检查。 Replace All
, until all duplicates are removed. Replace All
,直到删除所有重复项。 Replace All: 0 occurrence was replaced.
Replace All: 0 occurrence was replaced.
when it's complete.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.