no save
Assistance
Achat
News

Forum | Linux/Unix
[Perl] souci lecture fichier csv
Vince17, le ven. 26 janv. 2007 à 13:48:31
donc voici mon script actuel qui marche :d

#!/usr/bin/perl

open DB, ">/var/named/toto.fr";
open REV, ">/var/named/10.in-addr.arpa.rev";

$j = 0;
$i = 0;
open ADRIP, "tableip.csv";
while($ligne = <ADRIP>)
{
($nom[$j],$adr[$j]) = split /;/,$ligne;
#print "test $j $nom[$j] $adr[$j] \n";
$j++;
#print "fin de la boucle $j \n";
}
close ADRIP;

print DB
"\$\TTL\t86400\
@\tIN\tSOA\tent.toto.fr. root.toto.fr. (
1997022700\t; Serial
28800\t; Refresh
14400\t; Retry
3600000\t; Expire
86400 )\t; Minimum\n
@\tIN\tNS\tent.toto.fr
ent\tIN\tA\t10.2.2.145
test\tIN\tCNAME\tent\n";

print REV
"\$\TTL\t86400\
@\tIN\tSOA\tent.totofr. root.toto.fr. (
1997022700\t; Serial
28800\t; Refresh
14400\t; Retry
3600000\t; Expire
t86400 )\t; Minimum\n
@\tIN\tNS\tent.toto.fr.
1\tIN\tPTR\tent.toto.fr.\n";

while($i<$j)
{
print DB "$nom[$i]\tIN\tA\t$adr[$i]\n";
print REV "$adr[$i]\tIN\tPTR\t$nom[$i]\n";
$i++;
}

close DB; close REV;
Précédentlami20j
janv. 07
Vince17
janv. 07
Suivant
REPONSES
Vince17
janv. 07
bob031
janv. 07
lami20j
janv. 07
Vince17
janv. 07
lami20j
janv. 07
Vince17
janv. 07
Vince17
janv. 07
lami20j
janv. 07
Vince17
févr. 07
Version Web
Réalisé par RedShift
no save