Skip to content

Instantly share code, notes, and snippets.

@rupeshtr78
Created October 29, 2020 14:23
Show Gist options
  • Save rupeshtr78/f237aed47e7ca71c1e868320f143823c to your computer and use it in GitHub Desktop.
Save rupeshtr78/f237aed47e7ca71c1e868320f143823c to your computer and use it in GitHub Desktop.
import java.io.{FileWriter, PrintWriter}
import scala.io.Source
val fileLines = Source.fromFile("/data/bullflag.txt").getLines()
for ((line, n) <- fileLines zipWithIndex) {
val lineNumber = n+1
val fileName = s"line-$lineNumber.txt"
val filePath = s"/data/$fileName"
val fileWriter = new PrintWriter(new FileWriter(filePath))
fileWriter.write(line)
fileWriter.close()
Thread.sleep(20000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment