Groovy web console

subscribe to the feed Subscribe
to this
site

Chek1

Published 5 days ago by Chintan with tags createMap
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def s = """define contact{ contact_name IPNOC
alias                   Network Monitoring Center
email ip-noc@libertyglobal.com
use default_user
}
define contact{
contact_name dmariuscatalin
alias Diaconu Mariuscatalin
email madiaconu.contractor@libertyglobal.com
use default_user
}""";
def output = [:];
def matches = s.findAll(/(?<=name).*/);
def matches1 = s.findAll(/(?<=alias).*/);
for (i=0; i<matches.size; i++)
{
    output.put(matches[i].trim(), matches1[i].trim())
}
println(output);