sed替换两个符号之间的内容为别的内容怎么写

浏览:30日期:2023-06-08

问题描述

{ "port_password":{ "2016":"helloss", "1027":"wwwcc" }, "method":"aes-256-cfb", "timeout":600}

要把第三行中的helloss替换成haha可以下面这样sed -i 's/helloss/haha/g` filename但是helloss是不确定的,我只是想把第三行第二对双引号之间的内容替换成haha,应该怎么写啊

问题解答

回答1:

v2ex的@Strikeactor提供的

sed 's/'2016':'.*'/'2016':'haha'/' filename

回答2:

为什么不 parse 呢?

相关文章: