Created
March 1, 2011 16:10
-
-
Save danieldbower/849360 to your computer and use it in GitHub Desktop.
Example for Beginner's Guide to a Scripting Language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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