Friday, October 16, 2009

Removing lines context based with -pe

Removing lines with the -pe option.

perl -i -pe '
s/true/false/g;
s/^.+user-preferred.+$//g;
s/^.*(<\/cluster>.*)$/$1 xsi:nil="true">$2/g;
s/^.*(<\/machine>.*)$/$1 xsi:nil="true">$2/g;

if ($_ =~ // ) {
$ssl='on';
}
if ($_ =~ /listen-port/ and $ssl) {
$_ = undef;
$ssl= undef;
}
if ($_ =~ /
}

if ($_ =~ /<\/jta-migrat/ ) { $m = undef; $_ = undef; } ' spa/qas/config/config.xml vi spa/qas/config/config.xml

No comments:

Post a Comment