读好书,交益友
分类: PERL
2014-01-02 11:16:23
删除一个ip地址
my $strTemp = "";
open(FILE,"/etc/steelport/round-robin.txt");
while(
{
if(/192.168.9.196/)
{
#先删除指定行,为空行
$_ =~ s/^\w*$_//g;
#删除空行
$_ =~ s/^\s*$_//g;
}
$strTemp = $strTemp.$_;
#print " ",$strTemp;
}
open(FILE,"> /etc/steelport/round-robin.txt");
print FILE $strTemp;
close FILE;