Read formatted file one-liner


/ Published in: Groovy
Save to your folder(s)

Read a file with tabs


Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.