这是我想要更改的文件。我想在servers {
下添加一个条目。
eap-radius {
# Section to specify multiple RADIUS servers.
servers {
}
}
这就是我试过的
sed -i '/servers {/a\
server-a {
accounting = yes
secret = 123456
address = 127.0.0.1
auth_port = 1812
acct_port = 1813
}
' /etc/strongswan.d/charon/eap-radius.conf
sed:-e表达式#1,char 81:未终止的`s'命令
答案 0 :(得分:0)
我认为你需要逃避新行:
sed '/servers {/a\
server-a {\
accounting = yes\
secret = 123456\
address = 127.0.0.1\
auth_port = 1812\
acct_port = 1813\
}
' ./test.txt
结果是(我还标记了一点server-a
块):
eap-radius {
# Section to specify multiple RADIUS servers.
servers {
server-a {
accounting = yes
secret = 123456
address = 127.0.0.1
auth_port = 1812
acct_port = 1813
}
}
}
在Ubuntu 14.04.5 LTS上测试,GNU bash版本4.3.11(1) - 发布