Groovy web console

subscribe to the feed Subscribe
to this
site

map_result

Published 5 days ago by tabassum
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def output = """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 result = [:]

def matches = output.findAll(/(?<=contactgroup_name).*/)
 def matches1 = output.findAll(/(?<=UIM:).*/)
for (i=0; i<matches.size; i++)
{
   result.put(matches[i].trim(), matches1[i].replaceAll(/[; ]+/,"").trim())
}
println(result)