Skip to content

Instantly share code, notes, and snippets.

@ostretsov
Created January 1, 2015 13:14
Show Gist options
  • Save ostretsov/4a116e7bdb65d77484c5 to your computer and use it in GitHub Desktop.
Save ostretsov/4a116e7bdb65d77484c5 to your computer and use it in GitHub Desktop.
for (
file <- inputFiles
if file.isFile
) {
val lines = scala.io.Source.fromFile(file).getLines().toList
def grepScalaFrom(ln: Int): Unit = {
if (ln >= lines.length) -1
else {
if (lines(ln).matches(".*scala.*")) println(file+", "+(ln+1)+": "+lines(ln).trim)
grepScalaFrom(ln + 1)
}
}
grepScalaFrom(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment