Below script prints all the content of a file line by
line.
HelloWorld.groovy
String filePath = "C:\\Users\\Public\\data.json";
int totalLines=0
new File (filePath).eachLine { line ->
totalLines++
println "$line"
}
println "Total Lines Read : $totalLines"
No comments:
Post a Comment