首页 > 系统服务 > 详细

Linux sed命令 以行为单位编辑文本,或替换文本中的文字

时间:2019-01-14 20:45:25      阅读:275      评论:0      收藏:0      [点我收藏+]
sed -e 4a\newLine testfile 

首先查看testfile中的内容如下:

$ cat testfile #查看testfile 中的内容  
HELLO LINUX!  
Linux is a free unix-type opterating system.  
This is a linux testfile!  
Linux test 

使用sed命令后,输出结果如下:

$ sed -e 4a\newline testfile #使用sed 在第四行后添加新字符串  
HELLO LINUX! #testfile文件原有的内容  
Linux is a free unix-type opterating system.  
This is a linux testfile!  
Linux test  
newline   

Linux sed命令 以行为单位编辑文本,或替换文本中的文字

原文:https://www.cnblogs.com/wangziyi0513/p/10268790.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!