1、在匹配的内容前追加,123是匹配的内容,hello是追加的内容
sed -e '/123/ i\hello' a.txt
2、在匹配的内容后追加,123是匹配的内容,hello是追加的内容
sed -e '/123/ a\hello' a.txt
3、替换匹配的内容,123是匹配的内容,hello是替换后的内容
(1)sed -e '/123/ c\hello' a.txt
(2)sed "s#123#hello#g" a.txt
4、删除匹配的行
sed '/123/d' tmp.txt