I am trying to implement following in GROOVY script but getting errors:
Read contents of an HTML file in an array and then grep
for something in that array.
def file1 = new File("/path/to/the/file/xyz.html");
def lines = file1.readLines()
if ((-e "/path/to/the/file/xyz.html") and (!(grep /jira.bugtracker.com/, lines))
{
println (" the changes are present\n");
exit 0;
}
else
{
println (" the changes are not present\n");
exit 1;
}
Please review the code and suggest the correct method.