#!/usr/bin/perl -w
use Switch;
if ($#ARGV != 1 ) {
	print "source and out should be specified";
	exit;
}
$alignlog=$ARGV[0];
#$oldlist=$ARGV[1];
$newlist=$ARGV[1];
open(LOG,"<$alignlog");
open(LIST,">$newlist");
$valid=0;
$toprint="";
while(<LOG>)
{
$line=$_;
chop($line);
if($line=~/\s*Aligning File:\s+(\S+)/)
{
if($valid==1)
{
print LIST"$toprint\n";
}
$toprint=$1;
$valid=1;
}
if($line=~/No tokens survived to final node of network/ and $line=!/No tokens survived to final node of network at/ )
{
$valid=0;
}
}
if($valid==1)
{
print LIST"$toprint\n";
}
