Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前可以使用sed进行这样的替换:
sed -i 's/find/replace/g' /file
是否可以使用sed查找内容http {并在其后插入以下内容?
http {
\t/server_names_hash_bucket_size 64;(内容前的标签)?
\t/server_names_hash_bucket_size 64;
是的,可以通过以下方式完成\a:
\a
$ sed '/^http {/ a\\tserver_names_hash_bucket_size 64;' file
它将查找以http {(^代表行首) 开头的行,并将添加 ( \a) 您指定的文本。
^