码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2019-01-14 21:35:14      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:cat   print   linux sed   单位   替换   命令   编辑文本   文件   查看   

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命令 以行为单位编辑文本,或替换文本中的文字

标签:cat   print   linux sed   单位   替换   命令   编辑文本   文件   查看   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!