Thanks Marc. This is what I ended up doing:
Map readConfig(File rcFile) { rcFile.readLines(). findAll { it.trim().length() }. findAll { !it.startsWith('#') }. collectEntries { parts = it.split() [parts.head(), parts.tail().join(' ')] } } def rcFile = new File('X12deid.cfg') println readConfig(rcFile) Should I be raising a bug? R, rahul Rahul Somasunderam Engineer, Transcend Insights On Oct 5, 2015, at 1:39 PM, Marc Paquette <mar...@mac.com<mailto:mar...@mac.com>> wrote: How about : Map readConfig(File rcFile) { rcFile.readLines(). findAll { it.trim().length() }. findAll { !it.startsWith('#') }. collect { it.split()[0..1] }. collectEntries {it} } def rcFile = new File('X12deid.cfg') println readConfig(rcFile) ? The String#split() method does not take any arguments (ignoring the deprecated variants) but you can get a sub-array of length 2 with [0..1], then collectEntries will convert it to a Map. Marc Le 2015-10-05 à 16:05, Rahul Somasunderam <rsomasunde...@transcendinsights.com<mailto:rsomasunde...@transcendinsights.com>> a écrit : Hi, I'm getting this exception: Caught: java.lang.ClassFormatError: Illegal class name "String;1_groovyProxy" in class file String;1_groovyProxy java.lang.ClassFormatError: Illegal class name "String;1_groovyProxy" in class file String;1_groovyProxy at AnonX12.readConfig(AnonX12.groovy:2) at AnonX12$readConfig.callCurrent(Unknown Source) at AnonX12.run(AnonX12.groovy:8) I'm not sure how to debug it. This is my code: Map readConfig(File rcFile) { rcFile.readLines(). findAll { it.trim().length() }. findAll { !it.startsWith('#') }. collectEntries { it.split(' ', 2) } } def rcFile = new File('X12deid.cfg') println readConfig(rcFile) Can anyone give me a pointer as to where I should start? R, rahul Rahul Somasunderam Engineer, Transcend Insights The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information. The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information.