diff options
Diffstat (limited to 'fbench/util/separate.pl')
-rwxr-xr-x | fbench/util/separate.pl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fbench/util/separate.pl b/fbench/util/separate.pl new file mode 100755 index 00000000000..429ea4d0e37 --- /dev/null +++ b/fbench/util/separate.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl +# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +$sepcol = shift; + +if ($sepcol eq "") { + die qq{usage: separate.pl <sepcol> + Separate a tabular numeric file into chunks using a blank + line whenever the value in column 'sepcol' changes. +}; +} + +$oldval = -2; +$newval = -2; + +while (<>) { + if (/^#/) { + print; + } else { + chomp; + @vals = split; + $newval = $vals[$sepcol]; + if ($newval != $oldval) { + print "\n"; + $oldval = $newval; + } + print "@vals\n"; + } +} |