Forum Discussion
Anonymous
5 years agoIf you don't specify a loop variable, Groovy decides on one for you and calls it "it". You could specify it differently like this:
cli.before().eachLine{ loopvariable -> if(!(loopvariable=~/show running-config/)){ println(loopvariable) } }
Or
cli.before().eachLine{ line ->
if(!(line=~/show running-config/)){
println(line)
}
}
28 minutes ago, grantae said:Also did we have to use ~/show running-config/ or was there a non-regex way to identify the string? Curious since regex is new to me so I had to Google the ~ thing. It said it forced a regex string? Just want to know more about it.
That's just habit on my side. You could have done it=="show running-config".
Related Content
- 2 years ago
- 4 months ago
- 2 years ago