#!/usr/local/bin/perl -w
#use File::Copy;
#use File::Basename; 

$filvel=$ARGV[0];
$filnuv=$ARGV[1];

open(NUV,$filnuv);
<NUV>;<NUV>;<NUV>;<NUV>;<NUV>;<NUV>;
open(VEL,$filvel);
<VEL>;print "$filvel - $filnuv\n";
$_=<VEL>;print $_;
$_=<VEL>;print $_;
$_=<VEL>;print $_;
$_=<VEL>;print $_;
$_=<VEL>;print $_;

while (<VEL>) {
    chomp;
    last unless $_;
    $num=substr($_,0,3);
    $sta=substr($_,5,16);
    $x  =substr($_,21,15)+0.;
    $y  =substr($_,36,15)+0.;
    $z  =substr($_,51,15)+0.;
    $com=substr($_,67);

    next if $x==0 && $y==0 && $z==0;

    $_=<NUV>;
    chomp;
    $num1=substr($_,0,3);
    $sta1=substr($_,5,16);
    $x1  =substr($_,21,15)+0.;
    $y1  =substr($_,36,15)+0.;
    $z1  =substr($_,51,15)+0.;
    $com1=substr($_,67);

    $x=$x-$x1;
    $y=$y-$y1;
    $z=$z-$z1;
        
    printf("%3i  %16s %14.4f %14.4f %14.4f %s\n",$num,$sta,$x,$y,$z,$com);

}
while (<VEL>) {print}

close(VEL);
close(NUV);



__END__
