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

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

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

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


为什么不 parse 呢?


v2ex的@Strikeactor提供的

sed 's/"2016":".*"/"2016":"haha"/' filename
【热门文章】
【热门文章】