Home > Q&A > body text
1
2
3
4
5
6
7
8
{
"port_password":{
"port_password"
:{
"2016":"helloss",
"2016"
:
"helloss"
,
"1027":"wwwcc"
"1027"
"wwwcc"
},
"method":"aes-256-cfb",
"method"
"aes-256-cfb"
"timeout":600
"timeout"
:600
}
要把第三行中的helloss替换成haha可以下面这样sed -i 's/helloss/haha/g` filename但是helloss是不确定的,我只是想把第三行第二对双引号之间的内容替换成haha,应该怎么写啊
欧阳克2016-11-11 11:08:53
v2ex的@Strikeactor提供的
sed 's/"2016":".*"/"2016":"haha"/' filename
sed
's/"2016":".*"/"2016":"haha"/'
filename
三叔2016-11-11 11:08:30
为什么不 parse 呢?