0

我目前可以使用sed进行这样的替换:

sed -i 's/find/replace/g' /file

是否可以使用sed查找内容http {并在其后插入以下内容?

\t/server_names_hash_bucket_size 64;(内容前的标签)?

4

1 回答 1

1

是的,可以通过以下方式完成\a

$ sed '/^http {/ a\\tserver_names_hash_bucket_size 64;' file

它将查找以http {(^代表行首) 开头的行,并将添加 ( \a) 您指定的文本。

于 2013-05-25T22:44:52.110 回答