小编sat*_*aki的帖子

在一行中找到另一个字符串时如何替换字符串?

当在 unix 文件的一行中找到字符串 'ny' 时,我想用另一个字符串 'ab' 替换字符串 'xy'。

示例文本:

If we have xy today we can go to ny.
If we have xy tomorrow we can go to ny tomorrow.
If we have mn now we can go to ny now.
Run Code Online (Sandbox Code Playgroud)

输出文本应如下所示:-

If we have ab today we can go to ny.
If we have ab tomorrow we can go to ny tomorrow.
If we have mn now we can go to ny now.
Run Code Online (Sandbox Code Playgroud)

linux grep sed text-processing

1
推荐指数
1
解决办法
397
查看次数

标签 统计

grep ×1

linux ×1

sed ×1

text-processing ×1