Skip to content

Instantly share code, notes, and snippets.

@phonyphonecall
Created February 21, 2015 20:48
Show Gist options
  • Save phonyphonecall/c02e0ab45f21470e970b to your computer and use it in GitHub Desktop.
Save phonyphonecall/c02e0ab45f21470e970b to your computer and use it in GitHub Desktop.
Prints each iteration and area that falls within the specified bin
#!/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;
my $area = $line[4] * 1.0000000;
if($temp >= 0.0001 * $max and $temp <= $max) {
print "$line[0]\t$area\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