这可能对你有用GNU sed):
sed ‘/^http {/,/^}/!b;/^}/i\new content’ file
</code>
使用范围来关注
http
部分和
插入
结束前的新内容
}
。
也可以写成:
sed -e ‘/^http {/,/^}/{/^}/i\new content’ -e ‘}’ file
</code>