sed命令替换指定字符串后面内容

2024-12-27 07:12:23
推荐回答(2个)
回答1:

sed -r 's/(ATTR\{address\}==")[^"]*/\1ABC/' A

结果得到:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="ABC", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

回答2: