[ create a new paste ] login | about

Link: http://codepad.org/3etjza5d    [ raw code | output | fork ]

Perl, pasted on Feb 1:
#!/usr/bin/perl

use Getopt::Std;
use vars qw($opt_t);

&getopts('t:') or die "Erro: Opcao nao existe! Execute o programa seguindo o exemplo: run_contagem_final -t synop\n";

unless( $opt_t ){
    print "Entre com o Parametro 't' e o tipo correspondente.\n";
    print "Exemplo: run_contagem_final.pl -t synop\n";
    exit;
}

# nomes e diretórios para os arquivos de destino
my $arquivo = $opt_t."_totalmes.txt";
my $arquivo2 = $opt_t."_mediames.txt";
my $arquivo3 = $opt_t."_totaldiario.txt";

# efetua a cópia propriamete dita dos arquivos.
my $type = "2011_".$opt_t.".txt";
print "$type\n";
system("mv /meu/diretorio/total_mensal_$opt_t.txt >> $arquivo");
system("mv /meu/diretorio/$type >> $arquivo3");
system("mv /meu/diretorio/media_mensal_$opt_t.txt >> $arquivo2");


Output:
1
2
Entre com o Parametro 't' e o tipo correspondente.
Exemplo: run_contagem_final.pl -t synop


Create a new paste based on this one


Comments: