linux使用sed命令如何替换两个字符串之间的字符串
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,
sed命令替换指定字符串后面内容
sed -r 's/(ATTR\{address\}==")[^"]*/\1ABC/' A
结果得到:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="ABC", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"