Created
June 3, 2016 11:15
-
-
Save marcgeld/0691925e0138318afeea4141f02ee1e7 to your computer and use it in GitHub Desktop.
Generates a lot of text
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
#! /usr/bin/env groovy | |
import java.nio.file.attribute.BasicFileAttributes | |
TEXT_LEN = 9999 * 2 | |
TEST_TEXT = "Alfa Beta" | |
def text = "" | |
def ratio = TEXT_LEN / TEST_TEXT.length() | |
//println ratio | |
if ( ratio < 1.0 ) | |
{ | |
text = TEST_TEXT.substring(0, TEXT_LEN) | |
} | |
else { | |
(ratio + 1).times{ idx -> | |
text += sprintf("%04d", idx ) + " ${TEST_TEXT} " | |
} | |
text = text.substring(0, TEXT_LEN) | |
} | |
println "Text Lenght: ${text.length()}" | |
File file = new File("test.txt") | |
file.write text | |
println "Absolute path: ${file.getAbsolutePath()}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment