new File("simple.tab").withReader{r->
line = r.readLine();
println "first line: $line"
r.splitEachLine("\t"){fields->
println "fields on line: $fields"
}
}
linefeed = "\n" //or "\r\n" if the user chose so
lines = new File('pathtofile').text.split("${linefeed}")
Sunday, February 21, 2010
Groovy tips
How to use 'split' on each line of a file:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment