Once in a while the navigation department inputs the wrong SP start number
referenced to the preplots ex. start SP 3500 when it should be 3490. This script
takes as input the filename of the file you want to change, and the amount of SP
offset the recorded (wrong) SP number by.
IMPORTANT:
----------
You must add a "+" or a "-" in front of the SP change to be applied
SYNTAX: change_sp <FILENAME> <+/- SP TO CHANGE>
#!/opt/perl5/bin/perl
# Sub routine declaration
sub CheckCommandLineSyntax;
sub DisplayOnlineHelp;
# Main script
CheckCommandLineSyntax;
$outfile = "$ARGV[0]" . ".SPcor";
open (P190, "$ARGV[0]") or die ("Could not open $file.\n");
open (OUT, ">$outfile") or die ("Could not open $file.\n");
$x = 0;
$line = <P190>;
while ($line ne "") {
if (($line =~ /^V/g) or ($line =~ /^E/g) or ($line =~ /^S/g) or ($line =~ /^C/g) or ($line =~ /^T/g)) {
$SPInFile = substr ($line,20,5);
$CorrectedSP = eval($SPInFile . $ARGV[1]);
$CorrectedSP = " " . $CorrectedSP;
$CorrectedSP = substr($CorrectedSP, length($CorrectedSP) - 5, length($CorrectedSP));
$line =~ s/$SPInFile/$CorrectedSP/g;
print OUT ($line);
$x++;
if ($x == 500) {
print ("Now processing: \'$SPInFile\' -> \'$CorrectedSP\'\n");
$x = 0;
}
}
else {
print OUT ($line);
}
$line = <P190>;
}
close(P190);
close(OUT);
# Sub routine implementation
sub CheckCommandLineSyntax{
$arg_cnt = @ARGV;
if ($arg_cnt != 2){
DisplayOnlineHelp;
die ("SYNTAX: change_sp <FILENAME> <+/- SP TO CHANGE> ...\n\n");
}
}
sub DisplayOnlineHelp{
$~ = "HELP";
write;
}
format HELP =
change_sp v1.0
by
Kenneth Thorman
DESCRIPTION:
------------
Once in a while the navigation department inputs the wrong SP start number
referenced to the preplots ex. start SP 3500 when it should be 3490. This script
takes as input the filename of the file you want to change, and the amount of SP
offset the recorded (wrong) SP number by.
IMPORTANT:
----------
You must add a "+" or a "-" in front of the SP change to be applied
Script : change_sp
Version : 1.0
Author : Kenneth Thorman
Date : 21/6 - 2000
.
No comments:
Post a Comment