perl -i.bak -nle' BEGIN { print("IPADDR=", shift(@ARGV)) } print if !/^IPADDR=/; ' 1.1.1.1 dir/sys/network-scripts/ifcfg-eth0