Help for this page

Select Code to Download


  1. 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
    
  2. or download this
    print("IPADDR=$ip\n");
    while (<$fh_in>) {
        print $fh_out $_ if !/^IPADDR=/;
    }
    
  3. or download this
    my $found = 0;
    while (<$fh_in>) {
    ...
    }
    
    print("IPADDR=$ip\n") if !$found;