sed :找到匹配时替换整行

sed在文件中找到匹配项时如何用我们的内容替换一行

示例文件:/tmp/file

This is line one
This is line two
This is line three
This is line four

在这里,我们将搜索字符串为“two”的行,并将整行替换为“your text”

# sed '/two/cyour text' /tmp/file
This is line one
your text
This is line three
This is line four
日期:2020-06-02 22:17:33 来源:oir作者:oir