利用SED命令替换指定范围文本,范例一则

 

 

{
“id”: “b7******e2”,
“objtype”: “world”,
“roots”: [
{
“identity”: “b724e072e2:0:84d8ba8ecaa751a91e7b1fadb7952b1f5bae0b9d0789662194872b91cf651259e5ff4148a52e2ae2a2afddaaaf2e73f682d94b2c7d18619f0ad4da8442ee3b77”,
“stableEndpoints”: [“9.9.8.8/9993”]
}
],
“signingKey”: “842a6d45d70c392bc4ae392ba88f20a351702e32d123907595188e17a21a9e321e2a38a6ded25dcc94c1b5199746399c7a08b149148085d1843837aed418b178”,
“signingKey_SECRET”: “dfe01b3d79571e41fe400e35c71e363c5ce02490fe2fcec1afc1f29c08f67f1c44971121574bef5a5457cde1dde349716d7d73e9e437a46c576c87e4616b5d81”,
“updatesMustBeSignedBy”: “842a6d45d70c392bc4ae392ba88f20a351702e32d123907595188e17a21a9e321e2a38a6ded25dcc94c1b5199746399c7a08b149148085d1843837aed418b178”,
“worldType”: “moon”
}

 

来自脚本大佬的脚本:

sed -i ‘s#”stableEndpoints”: [“[0-9].[0-9].[0-9].[0-9]/#”stableEndpoints”: [“‘curl -Ls whatismyip.akamai.com‘/#’ moon.json

OR

sed -i ‘s#”stableEndpoints”: [“[^/]*/#”stableEndpoints”: [“‘curl -Ls myip.ipip.net | awk -F '[: ]' '{print $3}'‘/#’ moon.json

 

FROM:https://www.hostloc.com/thread-522417-1-1.html?d=1

共有 0 条评论

发表评论

邮箱地址不会被公开。 必填项已用*标注