linux使用sed命令如何替换两个字符串之间的字符串

2024-11-17 08:49:46
推荐回答(4个)
回答(1):

root@localhost:~# echo enable="true",url="http://10.25.136.232",showSlider="true",
enable=true,url=http://10.25.136.232,showSlider=true,
root@localhost:~# echo enable="true",url="http://10.25.136.232",showSlider="true",|sed 's@url=".*",s@url="https:\/\/test.com",s@g'
enable=true,url=http://10.25.136.232,showSlider=true,

回答(2):

sed 's/,url=".*",s/,url="https:\/\/test.com",s/g' filename

回答(3):

回答(4):

把url=".*" 变成 url=".*?"