#!/usr/local/gnu/bin/perl

#
# Layout of trajectory events:
#
# N:
# x1 y1 t1
# x2 y2 t2
# ...
#

TRAJ;

$basename = "traj.";

while (<>)
{
    if (/^[0-9]+:$/)
    {
        substr($_,-2) = "";
        
        $file = $basename . $_;

        print "Opening ", $file,  " ... \n";

        open TRAJ, ">$file" || die "Couldn't open() $file";
    }
    else
    {
        ($a,$b,$c) = split(' ', $_);

        print TRAJ $a, " ", $b, "\n";
    }
}
