Created
October 20, 2008 06:27
-
-
Save tyama/18027 to your computer and use it in GitHub Desktop.
This file contains 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
def clo = {f,c,skey-> | |
def r=[] | |
new File(f).text.trim().splitEachLine(/\t/){ r<<c(it) } | |
return [ | |
r.first().join("\t"), | |
r.tail().sort{it[skey]}*.join("\t").join("\n") | |
].join("\n") | |
} | |
println clo("data.csv",{[it[0],it[2],it[1],(it[3].isNumber())? it[3].toInteger()+1:it[3]]},0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment