Skip to content

Instantly share code, notes, and snippets.

@danieldbower
Created March 1, 2011 16:10
Show Gist options
  • Save danieldbower/849360 to your computer and use it in GitHub Desktop.
Save danieldbower/849360 to your computer and use it in GitHub Desktop.
Example for Beginner's Guide to a Scripting Language
//
// data
//
def values = """821;1529;56
733;1530;56
749;1533;56
728;1534;56"""
//
// code
//
values.eachLine{ val ->
//if you want to see the intermediate step of each value being transformed, uncomment the next line
//println val
def tokenized = val.tokenize(";")
println """insert into myTable (myColId, myCol2, myCol3) values (${tokenized[0]}, ${tokenized[1]}, ${tokenized[2]});"""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment