Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Count the number of commas in each line. Useful for checking simple CSV (but not proper, quoted CSV).
#!/usr/bin/env groovy
new File( args[0] ).eachLine{ it -> println it.count(',') }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.