sed '2a hellowrold' test.txt #在第二行之后追加
sed '2i helloworld' test.txt #在第二行之前追加
sed '3,4d' test.txt #删除第三行,第四行。
sed '/onboot/a hellowrold' test.txt #匹配到包含到onboot的行,在后边添加helloworld
sed '/^helloworld/d' test.txt #匹配以helloworld开头的行,并删除该行。
sed '/^$/d' test.txt #匹配到空白行并删除
sed 's/yes/no/;s/static/dhcp/' test.txt
sed 's/yes/no/' -e 's/static/dhcp/' test.txt
sed '2,8d' test.txt #删除2,8行
sed '3,+1p' test.txt #匹配3行以及后面的1行
sed '/body/{s//\/body/2}' test.txt #将第二个body替换尾\body
sed '/.*/{/^$/d}' test.txt #匹配到空白行并进行删除