如何使用sed
命令替换文件中第三次出现的字符串。
例子:
仅更改文件中第三次出现的is
to 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)