Skip to content

Instantly share code, notes, and snippets.

@phonyphonecall
Created February 21, 2015 19:10
Show Gist options
  • Save phonyphonecall/964c8bfb00f5e346c525 to your computer and use it in GitHub Desktop.
Save phonyphonecall/964c8bfb00f5e346c525 to your computer and use it in GitHub Desktop.
Produces all the data in specified bin on stdout. Cat stdout to file and use in your favorite plotting program.
#!/usr/bin/perl
use strict;
use warnings;
open(my $fd, "<", $ARGV[0]) or die "cannot open file $!";
my $max = -1;
my $count = -1;
while(<$fd>) {
$count++;
next if $count == 0;
my @line = split("\t", $_);
if ($max < $line[1]) {
$max = $line[1];
}
}
seek($fd, 0, 0);
$count = 0;
while(<$fd>) {
$count++;
next if $count == 0;
my @line = split("\t", $_);
no warnings 'numeric';
my $temp = $line[1] * 1.0000000;
if($temp > 0.001 * $max and $temp <= $max) {
print "$line[0]\t$temp\n";
}
}
close($fd);
@phonyphonecall
Copy link
Author

Usage

  • chmod 755 {script_name}
  • ./{script_name} {path_to_sa_log}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment