Skip to content

Instantly share code, notes, and snippets.

@alevchuk
Created January 23, 2011 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alevchuk/791803 to your computer and use it in GitHub Desktop.
Save alevchuk/791803 to your computer and use it in GitHub Desktop.
# Generate 1GB of random numbers and write them to a file
perl -e 'print STDERR "Grenerating data...\n"; while (1) { print rand() }' | \
dd count=62914560 bs=512 | perl -e '
# Accumulate and then Measure with dd
@all = ();
binmode(STDIN);
while (read(STDIN, $b, 1048576)) { # Read in 1 MB chunks
push(@all, $b);
}
close(STDIN);
print STDERR "\nWriting data...\n";
open(DD, "|dd bs=512 of=bigfile-1gb");
binmode(DD);
foreach (@all) {
print DD "$_";
}
close(DD);'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment