1
I have the file /etc/udev/rules.d/70-persistent-net.rules that have such interfaces:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="1c:af:f7:e7:a4:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="78:e3:b5:43:47:ad", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
I want to replace the eth0 with the eth1 and vice versa, tried to do with sed command unsuccessfully:
sed -i 's|eth0|eth1|g'
he exchanges the eth0 for eth1 obviously but now I have 2 interfaces eth1.
I wanted a command that "changes" the Strings of place, to get this result:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="1c:af:f7:e7:a4:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="78:e3:b5:43:47:ad", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
You’ll always have only two lines?
– user3603
no.. It was just by example same...
– Rakiz