【发布时间】:2021-10-08 08:02:21
【问题描述】:
假设我的文本为:
This is a sample text.
I have 2 sentences.
text is present there.
我需要替换两个“文本”单词之间的整个文本。所需的解决方案应该是
This is a sample text.
I have new sentences.
text is present there.
我尝试使用以下命令,但它不起作用:
sed -i 's/text.*?text/text\
\nI have new sentence/g' file.txt
【问题讨论】: