A.txt里面内容如下
A;
B;
C;
write by luohao199621;
1.要将“B;”换为"glad to see you; hello!"
linux 命令如下
sed -ie 's/B;/glad to see you; hello!/g' A.txt (文件夹所在路径)
2.要将"C;"删除
linux 命令如下
sed -ie 's/C;/ /g' A.txt (将"C;"替换为空就相当于删除)
本文介绍了如何利用Linux下的sed命令来实现文本内容的替换与删除操作。具体包括将特定字符串替换成另一字符串的方法,以及如何删除指定内容的步骤。
A.txt里面内容如下
A;
B;
C;
write by luohao199621;
1.要将“B;”换为"glad to see you; hello!"
linux 命令如下
sed -ie 's/B;/glad to see you; hello!/g' A.txt (文件夹所在路径)
2.要将"C;"删除
linux 命令如下
sed -ie 's/C;/ /g' A.txt (将"C;"替换为空就相当于删除)
2295
3778
4908
1198

被折叠的 条评论
为什么被折叠?