- or download this
perl -i.bak -nle'
BEGIN { print("IPADDR=", shift(@ARGV)) }
print if !/^IPADDR=/;
' 1.1.1.1 dir/sys/network-scripts/ifcfg-eth0
- or download this
print("IPADDR=$ip\n");
while (<$fh_in>) {
print $fh_out $_ if !/^IPADDR=/;
}
- or download this
my $found = 0;
while (<$fh_in>) {
...
}
print("IPADDR=$ip\n") if !$found;