#!usr/local/bin/perl

opendir (DIR, "$ARGV[0]") ||
	die;
open (OUTFILE, ">outfile.txt") ||
	die;
@file_names = readdir (DIR);
chdir ("$ARGV[0]") ||
	die;
#	print (@file_names);
foreach (@file_names) {
	$def_name = $file_names[$a];
	print ("Opening $def_name");
	open (FILE, $def_name) ||
		die ("Cannot open file $def_name\n");
## Abrindo os arquivos 
	print ("Opening $file_names[$a]\n");
	$linha = <FILE>;
	$pula_linha = 0;
	while ($pula_linha <20) {
		$linha = <FILE>;
		$pula_linha++;
		}
## Matando o tempo at�chegar aonde interessa...
	print OUTFILE ("$file_names[$a]\n\n\n");
	$linha = <FILE>;
	$pula_linha = 0;
	while ($pula_linha < 4) {
		$linha = <FILE>;
		$pula_linha++;
		}
	while ($linha = <FILE>) {
		@indice = split (/\t/, $linha);
		print OUTFILE ("$indice[3]\t$indice[9]\t$indice[11]\t$indice[23]\n");
		}
	close output;
	$a++;
	print ("$a\n");
}
