All pastes #1005233 Raw Edit

fetch.pl

public text v1 · immutable
#1005233 ·published 2008-05-02 18:06 UTC
rendered paste body
#/usr/local/bin/perl

while(<>){
  if(/\[Peak Table \(Ch1\)\]/){ $lookhere = true; }
  if($lookhere){
    @line = split( /\t/ );
    if($line[0]=="2") { $A = $line[7]; }
    if($line[0]=="6") { $B = $line[7]; }
    if($line[0]=="1") { $C = $line[7]; }
    if($line[0]=="5") { $D = $line[7]; }
  }
  if(/\[Compound Results \(Ch1\)\]/){
    last;
  }
}

# Calculate
$CV = (12.102*$A + 11.96*$B + 37.706*$C)/100;
$SG = (0.0696*$A + 0.9671*$B + 0.5539*$C + 1.5195*$D)/100;
$WI = $CV / sqrt($SG);
$FS = (3.39*$A + 0.61*$B + 1.48*$C) / (1 + 0.0239*($A+$B) + 0.0955*$C + 0.05*$D);

# Print the output, tab-separated
print "CV\t$CV\n";
print "SG\t$SG\n";
print "WI\t$WI\n";
print "FS\t$FS\n";