#!/usr/bin/perl ###################################################################### # Tool for the dxspider webcluster script to create dxcc.list from # prefix_data.pl of dx-spider # Start this tool whenever prefix_data.pl has been updated. ###################################################################### # # Hans-J. Barthen, DL5DI # # feb 19th 2008 # ###################################################################### if(open(PFXDAT,"/spider/data/prefix_data.pl")) { $found = 0; $max = 0; if(open(DXCC,">/spider/data/dxcc.list")) { while($found == 0) { $line = ; if(index($line,"prefix") != 1){ print"."; } else { $found = 1; } } while($line = ){ $line =~ s/[ \t\']//g; # print"$line\n"; ($dummy,$list,$dummy) = split(/[{}]/,$line,3); # print "$list\n"; ($name,$dxcc,$rest) = split(/[,]/,$list,3); $dxcc =~ s/dxcc=>//; $name =~ s/name=>//; # ($dxcc,$rest) = split(/=/,$line,2); # print "$dxcc ### $rest\n"; # ($dummy,$country,$dummy) = split(/\'/,$rest,3); # print("$dxcc $country\n"); $j = 0; while( $j == 0 ) { ($dummy,$pfx) = split(/-/,$name,2); if(index($pfx,"-") > 0){ $name = $pfx; } else { $j = 1; } } print "$dxcc $pfx $max\n"; $Pref[$dxcc] = $pfx; if($dxcc > $max) { $max = $dxcc; print "max: $max\n"; } } for($i = 1;$i <= $max;$i++) { print"$i $max $Pref[$i]\n"; print(DXCC "$Pref[$i]\n"); } } close(DXCC); close(PFXDAT); } else { print "\nFile not found / Datei nicht vorhanden !\n"; }