Groovy web console

subscribe to the feed Subscribe
to this
site

Task3-modified

Published 5 months ago by gokul
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def COMMAND_RESULT = """define contactgroup{ contactgroup_name webio-admins
alias UIM:NAGIOS-TEST-WEBIO;
members emusic
}
define contactgroup{
contactgroup_name voice_ops
alias UIM:NAGIOS-TEST-WEBIO1;
members emusic,mkopitsch,gmohan
}"""
def list=COMMAND_RESULT.split(" ");
if(COMMAND_RESULT.contains('UIM:NAGIOS-TEST-WEBIO;'))
{
    if(COMMAND_RESULT.contains('afasiolo'))
    {
        exit();
    }
    else
    {
    def names = COMMAND_RESULT.findAll(/(?<=).*/)   
    len=names.indexOf('}');
    lengtht= len -1;
    //print lengtht
    names.add(lengtht,"afasiolo")
    println names
    
    }
}