Linux-SED

来源:互联网 发布:linux如何停掉mysql 编辑:程序博客网 时间:2024/05/21 08:37

Sed (Strem Editor)

1. 语法

普模式

sed [options] {sed-commands} {input-file}

批处理

sed [options] -f [sed-commands-in-file] {input-file}
sed [options] -e [cmd1] -e [cmd2] {input}

2. 脚本执行流程

R read a line into the pattern space
E Excute the cmd on the pattern space
P Print the pattern
R Repeat for next line until end of the file txt
sed -n ‘2,4 p’ print 2, 3, 4 line
2~3 间隔3行
2,+4 2到6行

0 0
原创粉丝点击