Created
February 21, 2015 20:48
-
-
Save phonyphonecall/c02e0ab45f21470e970b to your computer and use it in GitHub Desktop.
Prints each iteration and area that falls within the specified bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
chmod 755 {script_name}
./{script_name} {path_to_sa_log}