diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /fbench/util/separate.pl |
Publish
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"; + } +} |