1,基本结构
sed [option] {cmd} {input_file}
sed -n 'p' test.log
2,sed执行基本过程
read -> execute -> print -> repeat
3,在每一行执行多个命令,答应以name和test开头的行
sed -n -e '/^name/p' -e '/^test/p' test.log
4,打印 p, 拟制打印 n
5,删除 d
6,替换 s
sed ‘/pattarn/s/old/new/[flag]’ input_file
sed '/test/s/old/new/' input //substitute the first old to new, like vim
sed '/test/s/old/new/g' input //substitute all the old to new, like vim
7, g标志
8,数字标志(1,2,3),只替换第n次出现的地方。
sed '/test/s/old/new/2' input //substitute the second old to new
9,