Posted By

miceno on 12/30/10


Tagged

read split formatting


Versions (?)

Read formatted file one-liner


 / Published in: Groovy
 

URL: http://snipplr.com/developer/

Read a file with tabs

  1. new File("simple.tab").withReader{r->
  2. line = r.readLine();
  3. println "first line: $line"
  4. r.splitEachLine("\t"){fields->
  5. println "fields on line: $fields"
  6. }
  7. }

Report this snippet  

You need to login to post a comment.