[FLUG]

  • From: "Carlo" <carlo@xxxxxxxxxxxxxxx>
  • To: fanolug@xxxxxxxxxxxxx
  • Date: Sat, 14 Dec 2002 10:47:42 -0000

Mailing List del Fortunae LUG
=============================

#!/usr/bin/perl
unlink "out.csv";
open (IN, "<tutte.csv");
open (USER, ">>user.csv");
open (GRP, ">>group.csv");
@file= <IN>;
close IN;
print USER "[Users]\r\r";
$q=@file;
$i=0;
while($i<$q)
{
@out=split(/;/, @file[$i]);
$username=@out[0];
$username=~ s/\s+//g;
print USER "$username,@out[1] @out[2],,@out[4],@out[5],@out[6],@out[7]";
if (@out[4] eq "1° A BIENNIO") {push(@a1ab, $username, ",")};
if (@out[4] eq "1° A GRAFICA") {push(@a1ag, $username, ",")};
if (@out[4] eq "1° B BIENNIO TED") {push(@a1bb, $username, ",")};
if (@out[4] eq "1° B GRAFICA") {push(@a1bg, $username, ",")};
if (@out[4] eq "2° A BIENNIO") {push(@a2ab, $username, ",")};
if (@out[4] eq "2° A GRAFICA") {push(@a2ag, $username, ",")};
if (@out[4] eq "2° B BIENNIO") {push(@a2bb, $username, ",")};
if (@out[4] eq "2° B GRAFICA") {push(@a2bg, $username, ",")};
if (@out[4] eq "3° A AZIENDALE") {push(@a3ac, $username, ",")};
if (@out[4] eq "3° A GRAFICA") {push(@a3ag, $username, ",")};
if (@out[4] eq "3° A TURISTI") {push(@a3at, $username, ",")};
if (@out[4] eq "3° B AZIENDALE") {push(@a3bc, $username, ",")};
if (@out[4] eq "3° B GRAFICA") {push(@a3bg, $username, ",")};
if (@out[4] eq "4° A AZIENDALE") {push(@a4ac, $username, ",")};
if (@out[4] eq "4° A GRAFICA") {push(@a4ag, $username, ",")};
if (@out[4] eq "4° A TURISTI") {push(@a4at, $username, ",")};
if (@out[4] eq "4° B AZIENDALE") {push(@a4bc, $username, ",")};
if (@out[4] eq "4° B GRAFICA") {push(@a4bg, $username, ",")};
if (@out[4] eq "5° A AZIENDALE") {push(@a5ac, $username, ",")};
if (@out[4] eq "5° A GRAFICA") {push(@a5ag, $username, ",")};
if (@out[4] eq "5° A TURISTI") {push(@a5at, $username, ",")};
if (@out[4] eq "5° B AZIENDALE") {push(@a5bc, $username, ",")};
if (@out[4] eq "5° B GRAFICA") {push(@a5bg, $username, ",")};
$i++;
}
print GRP "\r\r";
print GRP "[Global]\r\r";

print GRP "1a biennio,,@a1ab\r";
print GRP "1a grafici,,@a1ag\r";
print GRP "1b biennio,,@a1bb\r";
print GRP "1b grafici,,@a1bg\r";
print GRP "2a biennio,,@a2ab\r";
print GRP "2a grafici,,@a2ag\r";
print GRP "2b biennio,,@a2bb\r";
print GRP "2b grafici,,@a2bg\r";
print GRP "3a contabili,,@a3ac\r";
print GRP "3a grafici,,@a3ag\r";
print GRP "3a turisti,,@a3at\r";
print GRP "3b contabili,,@a3bc\r";
print GRP "3b grafici,,@a3bg\r";
print GRP "4a contabili,,@a4ac\r";
print GRP "4a grafici,,@a4ag\r";
print GRP "4a turisti,,@a4at\r";
print GRP "4b contabili,,@a4bc\r";
print GRP "5a contabili,,@a5ac\r";
print GRP "5a turisti,,@a5at\r";
print GRP "5b contabili,,@a5bc\r";
print GRP "5b grafici,,@a5bc\r";
close USER;
close GRP;


il formato del file accettato da addusers.exe e' di questo tipo

[Users]

nomeutente,Nome
completo,,Descrizione,unita':,\\nomeserver\nomecondivisione\directory,\\nomeserver\nomecondivisione\directory
e cosi' via

[Global]
NomeGruppo,,utente1,utente2,etc
e cosi' via

il codice per sopra processa un file csv, che viene fuori da excel, e lo
mette in un file
csv pronto per addusers.exe, ora siccome c'ho sonno, voglia di commentarlo
-3 pero' e'
facile, anche se poteva essere scritto meglio

burp


________________________________________________
Message sent using UebiMiau 2.7

--
Le raccomandazioni della mamma di simon "non prendere freddo, copriti... e 
prendi il palmare"

Other related posts: