#!/usr/bin/perl -w

#
#  hitlists_final_cut_prefix
#  Copyright (C) 2010 by USC/ISI
#  $Id$
#  
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License,
#  version 2, as published by the Free Software Foundation.
#  
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License along
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#  
#  
#  This code was originally written by Xun Fan <xunfan@isi.edu>.
#

use Fsdb::IO::Reader;
use Fsdb::IO::Writer;

my $input_stream = new Fsdb::IO::Reader(-fh => \*STDIN, -fscode => 't');
my $output_stream = new Fsdb::IO::Writer(-fh => \*STDOUT, -fscode => 't', -cols => [qw(hexip score ip)]);

my $def_history = 'l';
my @input_arow;

sub read_rows{
        $input_stream->read_row_to_aref(\@input_arow) or return undef;
	return ($input_arow[0], $input_arow[1], $input_arow[2], $input_arow[3]);
}

my $count = 0;

for (;;){
	my($prefix, $hex_ip, $score, $ip) = &read_rows;
	last if (!defined($ip)); #EOF
	
#	print "$hex_ip\t$score\t$ip\n";
	$output_stream->write_row($hex_ip, $score, $ip);
}

