![](/img/trans.png)
[英]how to replace string from one span to another in notepad++ with regex
[英]How to use notepad++ to replace values from another file one at a time
我有一个文本文件(fileA),它具有相同的文本块100次(大约)
我还有一个文本文件(fileB),它具有100个(大约)值,每行一个。
我想搜索fileA,并且每次找到模式时,都将模式替换为fileB的下一行,即,将模式的第一次出现替换为fileB的第一行,将第二次出现替换为fileB的第二行,等等。
让我用伪代码编码要在Perl中执行的操作:
let subst_file = open(cmd-line arg 1) for reading, or exit with error
while line = line from stdin
if pattern contained in line:
replace_pattern = read next line from subst_file
replace_line = regexp_replace(line, pattern, replace_pattern)
output replace_line
else:
output line
其余部分留给他人或您自己的研究。 例如,perl中的while循环为: while (my $line = <STDIN>) { ... }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.