#!/usr/bin/perl 
$path = "/Volumes/dataA2/project/calcofi/SCIMS Data and Analysis/2006/0602JD/Navigation/";
$infile = $path . "0602AllInOne.ELG";
$outfile = $path . "0602AllInOneClean.ELG";
open(FILE,"< $infile") || die $!;
open(OUT,"> $outfile") || die $!;
$cnt = 1;
foreach $val (<FILE>) {
	$_ = $val;
	s/,\cM//g;	
	$val = $_;
	chomp($val);
	@fields = split(/,/,$val);
	if ($fields[$#fields] < 25) {
		print OUT $val."\n";
	} else {
		print OUT join(',',@fields[0 .. $#fields-4]).",NaN,NaN,NaN,NaN\n";
	}
}
close(FILE);
