zjzc01:/root/big2# cat a27.pl
$curip="$ARGV[0]";
$str='export CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.hostname=$curip -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10053 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false';
$str =~ s/$curip/$curip/g;
open( C, "<", "pp.txt" ) || die "$!
";
while (<C>) {
chomp $_;
if ($. == 2 ){
print "$str
";
print "$_
";
}
else {print "$_
";}
}
zjzc01:/root/big2# perl a27.pl 2.2.2.2
a
export CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.hostname=2.2.2.2 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10053 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
b
c
d
e
f
g