print "Please enter the ip address for this machine. This will be eth0:\n"; my $ip = <>; chomp $ip; my $if0 = "ifcfg-eth0"; my $if1 = "ifcfg-eth1"; my $ifdir = 'network-scripts'; my $ifsub1 = "IPADDR="; my $ifsub2 = "BOOTPROTO="; my $ifsub3 = "none"; open (IP, "<", "$dir/$sys/$ifdir/$if0"); open (NEW, ">", "$dir/$sys/$ifdir/$if0.new"); while (){ s/^$ifsub2.*/$ifsub2$ifsub3/; s/^$ifsub1.*/$ifsub1$ip/ || print "$ifsub1$ip\n"; print $_; #print "$ifsub1$ip\n"; <==I tried it here too } close IP; close NEW; #### IPADDR=1.1.1.1 # Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] IPADDR=1.1.1.1 DEVICE=eth0 IPADDR=1.1.1.1 BOOTPROTO=none IPADDR=1.1.1.1 DHCPCLASS= IPADDR=1.1.1.1 HWADDR=00:0C:29:97:01:F3 IPADDR=1.1.1.1 ONBOOT=yes #### # Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] DEVICE=eth0 BOOTPROTO=dhcp DHCPCLASS= HWADDR=00:0C:29:97:01:F3 ONBOOT=yes