This script modifies Linux/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETHX network card files in the network card one, network card two IP address (ipaddr), subnet mask (NETMASK) information
#!/bin/sh
Proc=/bin/sed
File_path1=/etc/sysconfig/network-scripts/ifcfg-eth0
File_path2=/etc/sysconfig/network-scripts/ifcfg-eth1
Ip_primal1= ' grep-i ipaddr $FILE _path1|awk-f "=" ' {printf $} '
Mask_primal1= ' grep-i netmask $FILE _path1|awk-f "=" ' {printf $} '
Ip_primal2= ' grep-i ipaddr $FILE _path2|awk-f "=" ' {printf $} '
Mask_primal2= ' grep-i netmask $FILE _path2|awk-f "=" ' {printf $} '
ip_modi1=192.168.1.200
mask_modi1=255.255.255.0
ip_modi2=192.168.2.200
mask_modi2=255.255.255.0
$PROC-E "s/$IP _primal1/$IP _modi1/g"-E "s/$MASK _primal1/$MASK _modi1/g" $FILE _path1>ifcfg-eth0.bak
$PROC-E "s/$IP _primal2/$IP _modi2/g"-E "s/$MASK _primal2/$MASK _modi2/g" $FILE _path2>ifcfg-eth1.bak
CP-PF./ifcfg-eth0.bak $FILE _path1
CP-PF./ifcfg-eth1.bak $FILE _path2
Cat $FILE _path1
Cat $FILE _path2
Service Network restart
File Download Address: http://download.csdn.net/source/3032618