local $/ = "\n}\n"; while (<>) { s/ ^(fixed-address [^\n]*\n) (.*) ^(hardware ethernet [^\n]*\n) /$3$2$1/xsm; print; }