2386/print-the-line-if-it-contains-specific-string-by-using-groovy
I am having a Jenkins log file and I am trying to print those lines which are having string "FOUND" in it.
How do I write the code for it in Groovy as I am new to it? Can anyone help me with this?
Thanks.
You can try the code written below:
def lines = new File('/tmp/test123.txt').readLines() def result = lines.findAll { it.contains('FOUND') } println result*.toString() I hope that it will resolve your query.
The option “Launch agent by connecting it ...READ MORE
Yes, you can create a Jenkins pipeline ...READ MORE
In the illustration below, i have created a ...READ MORE
The command looks something like this: java -jar ...READ MORE
Hey @nmentityvibes, you seem to be using ...READ MORE
Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE
It can work if you try to put ...READ MORE
When you use docker-compose down, all the ...READ MORE
While you are trying , just try ...READ MORE
Since the container gets destroyed once the ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.