#!/usr/bin/perl -w

$path = "/Volumes/dataA2/project/calcofi/SCIMS Data and Analysis/2006/0602JD/Fluorometer/";
$infile = $path . "DSJ-Online-SCUFA.ELG";
$outfile = $path . "CleanedUp.ELG";
open(FILE,"< $infile") || die $!;
open(OUT,"> $outfile") || die $!;
$count = 1;
foreach $val (<FILE>) {
	chomp($val);
	$blah = 0;
	@vals = split(/,/,$val);
	next if $#vals < 9;
	next if (($vals[4] eq '') || ($vals[5] eq ''));
	for ($i=0;$i<=3;$i++) {
		if ($vals[$i+6] eq '') {
			$vals[$i+6] = 'NaN';
		}
	}
	$outLine = join(",",@vals[4 .. 9]);
	$outLine =~ s/\s//g;
	print OUT $outLine . "\n";
}
close(FILE);
close(OUT);
