Created
November 30, 2018 08:15
-
-
Save bobbyjam99-zz/0f9eca3bda53a94599f434f49ce9b594 to your computer and use it in GitHub Desktop.
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 java.io.* | |
fun main(args: Array<String>) { | |
val inputFilePath = "/path/to/inputfile" | |
val outputFilePath = "/path/to/outputfile" | |
val times = 1 | |
val lines = ArrayList<String>() | |
var header = "" | |
try { | |
val file = File(inputFilePath).absoluteFile | |
file.forEachLine { | |
if (it.isNotBlank()) { | |
lines.add(it) | |
} | |
} | |
header = lines.get(0) | |
lines.removeAt(0) | |
} catch (e: FileNotFoundException) { | |
println(e) | |
} | |
File(outputFilePath).bufferedWriter().use { out -> | |
out.appendln(header) | |
for(i in 1..times) { | |
for(s in lines) { | |
out.appendln(s) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment