指定位置后插入行
sed -i '/match reg/a\line1\nline2' target.txt
指定位置前插入行
sed -i '/match reg/i\line1\nline2' target.txt