小编Sur*_*mar的帖子

如何仅替换文件中模式的第 N 次出现?

如何使用sed命令替换文件中第三次出现的字符串。

例子:

仅更改文件中第三次出现的isto us

我的输入文件包含:

hai this is linux.
hai this is unix.
hai this is mac.
hai this is unchanged.
Run Code Online (Sandbox Code Playgroud)

预期的输出是:

hai this is linux.
hai thus is unix.
hai this us mac.
hai this is unchanged.
Run Code Online (Sandbox Code Playgroud)

sed perl text-processing

12
推荐指数
2
解决办法
3万
查看次数

标签 统计

perl ×1

sed ×1

text-processing ×1