sed 行对象【插入】【追加】【替换】
来源:互联网 发布:java程序员发展规划 编辑:程序博客网 时间:2024/04/30 01:30
sed行对象【插入】【追加】【替换】
All these three commands are for line object, not string.
一、Insert
i newlinewords
insert one new line before line positioned by key word
linenumi newlinewords
insert one new line before line i
[braveyly@m-net ~]$ cat sedaci.txt
word
word
word
[braveyly@m-net ~]$sed –e ‘1iStudent’ sedaci.txt
student
word
word
word
[braveyly@m-net ~]$sed –e ‘1,2iStudent’ sedaci.txt
student
word
student
word
word
[braveyly@m-net ~]$sed –e ‘/w/iStudent’ sedaci.txt
student
word
student
word
student
word
[braveyly@m-net ~]$sed –e ‘/d/i Student’ sedaci.txt
student
word
student
word
student
word
二、Apend
The syntax is completely the same with insert.The difference is that append command puts one new line after line position.
[braveyly@m-net ~]$sed –e ‘/w/a Student’ sedaci.txt
word
student
word
student
word
student
三、Change
The syntax is completely the same with insert and append.
The difference is that change command replace the old line with the new line.
[braveyly@m-net ~]$ cat sedaci.txt
word
word
word
[braveyly@m-net ~]$sed –e ‘1cStudent’ sedaci.txt
student
word
word
[braveyly@m-net ~]$sed –e ‘/w/cStudent’ sedaci.txt
student
student
student
- sed 行对象【插入】【追加】【替换】
- sed指定某行插入、追加、全局替换
- sed指定某行插入、追加、全局替换
- sed行尾追加变成了行首替换
- sed 指定行插入和替换
- sed字符串对象【替换】
- 可变数组的追加,插入,删除,替换
- sed行对象【列表】和单个字符对象【替换】
- SED 跨行替换
- sed替换整行
- js 行追加 全部替换
- 空对象调用属性或方法,equals();;StringBuffer简单用法,字符串的追加,插入和替换。
- sed 替换跨行内容
- sed替换跨行内容
- sed 替换
- sed替换
- sed 替换
- sed替换
- jquery之jquery事件处理模型(影响事件传播)
- 为什么要使用头文件
- 写给还没看过武侠小说的人
- linux shell 学前准备
- Android系统的Binder机制之一——Service Manager
- sed 行对象【插入】【追加】【替换】
- [Java] Overrid 方法重写
- Android系统的Binder机制之二——服务代理对象(1)
- 解决eclipse “The project cannot be built until build path errors are resolved”
- Android系统的Binder机制之三——服务代理对象(2)
- 正则表达式
- 关于hibernate的save的问题。
- js 正则表达式验证大全
- Android下编译OpenSSL静态库