Skip to content

Instantly share code, notes, and snippets.

@nicdoye
Created January 31, 2013 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicdoye/4684054 to your computer and use it in GitHub Desktop.
Save nicdoye/4684054 to your computer and use it in GitHub Desktop.
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