This topic created in 1270 days ago, the information mentioned may be changed or developed.
{name: "test1", server: xxxxxxx, port: 12345, type: ssr, cipher: chacha20-ietf, password: 12345, protocol: auth_aes128_sha1, obfs: plain, protocol-param: 15978:riUoXP, obfs-param: xxxxxxxxxxxxxxx, udp: true}
{name: "test2", server: xxxxxxx, port: 12345, type: ssr, cipher: chacha20-ietf, password: 12345, protocol: auth_aes128_sha1, obfs: plain, protocol-param: 15999:riUoXP, obfs-param: xxxxxxxxxxxxxxx, udp: true}
…………………………
有多个这样的文本内容,我想把全文中 protocol-param 的参数两边加上单引号,请问用 sed,awk 之类的命令要如何写呢?
我之前写了个:sed -r "s/protocol-param:(.*),/protocol-param:'\1',/g" Foo.yaml
但是输出是:
{name: "test1", server: xxxxxxx, port: 12345, type: ssr, cipher: chacha20-ietf, password: 12345, protocol: auth_aes128_sha1, obfs: plain, protocol-param:' 15978:riUoXP, obfs-param: xxxxxxxxxxxxxxx', udp: true}
后面的'单引号加在了最后一个,逗号前了,V 友有什么好办法吗?