Assuming order is not important and there are no duplicates I would read the file into a hash and then change the values of interest:
use strict; use warnings; my %config = map { /(.*)=(.*)/ } <DATA>; $config{'IPADDR'} = '1.2.3.4'; print "$_=$config{$_}\n" for keys %config; __DATA__ DEVICE=eth0 ONBOOT=yes BOOTPROTO=static TYPE=Ethernet IPADDR=10.9.0.200 NETMASK=255.255.0.0 GATEWAY=10.9.1.254
In reply to Re: Update config file parameters
by hdb
in thread Update config file parameters
by pavan.gup
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |