Created
April 28, 2010 12:33
-
-
Save duboisf/382077 to your computer and use it in GitHub Desktop.
tail.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.io.Source | |
import java.io.File | |
object Tail { | |
def main(args: Array[String]) { | |
val filesource = Source.fromFile(new File(args(1))) | |
val lines = filesource.getLines().toList | |
lines.drop(lines.length - args(0).toInt).map(println) | |
filesource.close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment