Skip to content

Instantly share code, notes, and snippets.

@masanobuimai
Created October 12, 2010 08:20
Show Gist options
  • Save masanobuimai/621842 to your computer and use it in GitHub Desktop.
Save masanobuimai/621842 to your computer and use it in GitHub Desktop.
// g100pon #24 grep
startDir = "."
filePattern = /\.groovy$/
pattern = /groovy/
enc = "windows-31j"
new File(startDir).eachFileRecurse { file ->
if (file =~ filePattern) {
file.eachLine(enc) { line, count ->
if (line =~ pattern) {
println "${file.path}:${count}:${line}"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment