#!/usr/local/bin/perl # gauqjigsaw1.pl # by Apollia of Astroblahhh.Com - http://astroblahhh.com/ Completed July 19, 2004. # # Public domain. # INFORMATION FOR THIS PROGRAM # # This is a script for converting the lines of data in the Gauquelin data files # at http://cura.free.fr/gauq/17archg.html to JigSaw 2 format data files. This # script only works for the following files: # #--> Sports Champions (Champions de Sport) = volume 1 #--> Men of Science (Hommes de Science) = volume 2 #--> Military Men (Hommes de Guerre) = volume 3 #--> Musicians (Musiciens) = volume 4 (1) #--> Painters (Peintres) = volume 4 (2) #--> Actors (Acteurs) = volume 5 (1) #--> Politicians (Hommes Politiques) = volume 5 (2) #--> Writers & Journalists (Écrivains et Journalistes) = volume 6 # # Another script will be needed to process the other Gauquelin data files. # # To use this script, you will need to make a text file called "astroinputfile.txt" # in the same directory as the script, and put some of the Gauquelin data from # the above files at http://cura.free.fr/gauq/17archg.html in the file. The # script doesn't need any arguments to run; running it by typing something like # "perl gauqastro1.pl" should suffice. The results will be output to a file # called "astrooutputfile.txt". You'll probably want to rename the file to # something else, ending in .DAT, so you can use it in JigSaw. # # You may not have to use this script at all, however, unless you want to # modify it to do something different, since there should already be files of # the Gauquelin data converted to JigSaw 2.0 format using this script, at # http://astroblahhh.com/ open(INPUTFILE,"astroinputfile.txt"); open(RESULTS, ">astrooutputfile.txt"); my $curline; $quot="\""; while ($curline = ) { $persontype =substr($curline,0,1); $numbr =substr($curline,1,4); $country =substr($curline,5,1); $day =substr($curline,6,2); $month =substr($curline,8,2); $year =substr($curline,10,4); $hour =substr($curline,14,2); $min =substr($curline,16,2); $sec =substr($curline,18,2); $zone =substr($curline,20,2); $latdeg =substr($curline,22,2); $lat =substr($curline,24,1); $latmin =substr($curline,25,2); $londeg =substr($curline,27,2); $lon =substr($curline,29,1); $lonmin =substr($curline,30,2); $place =substr($curline,32,15); $dept =substr($curline,47,9); $month=MakeIntoOneChar($month); $min=MakeIntoOneChar($min); $sec=MakeIntoOneChar($sec); $latmin=MakeIntoOneChar($latmin); $lonmin=MakeIntoOneChar($lonmin); $latdeg=MakeIntoOneChar($latdeg); $londeg=MakeIntoOneChar($londeg); if ($zone eq " 0") { $zonetext="GMT"; } elsif ($zone eq "-1") { $zonetext="CET"; }; $numbr=~s/ //g; #strips out empty spaces # The program won't distinguish correctly between the M for Military Man in # Volume 3 and the M for Musician in Vol. 4A or the P for Painter in Vol. 4B # and the P for Politician in Vol 5B. if ($persontype eq "C") { $persontype="Sports champion"; } elsif ($persontype eq "S") { $persontype="Scientist"; } elsif ($persontype eq "M") { $persontype="Military man"; } elsif ($persontype eq "P") { $persontype="Painter"; } elsif ($persontype eq "M") { $persontype="Musician"; } elsif ($persontype eq "A") { $persontype="Actor"; } elsif ($persontype eq "P") { $persontype="Politician"; } elsif ($persontype eq "W") { $persontype="Writer"; } elsif ($persontype eq "J") { $persontype="Journalist"; } if ($country eq "F") { $country="France"; } elsif ($country eq "I") { $country="Italy"; } elsif ($country eq "G") { $country="Germany"; } elsif ($country eq "B") { $country="Belgium"; } elsif ($country eq "N") { $country="Netherlands"; }; $place=~s/ //g; #strips out empty spaces, including, #slightly unfortunately, the ones between words $place=~tr/A-Z/a-z/; #makes it all lowercase substr($place,0,1)=~tr/a-z/A-Z/; #capitalizes first letter $dept=~s/ //g; chomp $dept; print RESULTS "$quot$numbr $persontype$quot,$year,$month,$day,$hour,$min,$sec,0,3,$quot$zonetext$quot,$zone,$quot$place,$country,$dept$quot,"; # Now we have to do a tedious conversion process for the latitude and longitudes # because internally, JigSaw stores the darned things as numbers like 40.7 # instead of 40N42. Have to divide the minutes by 60 (i.e, 42/60 = .7) to get # the numbers after the decimal point. $latmin=$latmin/60; $lonmin=$lonmin/60; # And then we have to cut the '0.' off the beginning of the string. $latmin=RemoveZeroDecimal($latmin); $lonmin=RemoveZeroDecimal($lonmin); if ($lon eq "E") { print RESULTS "-"; }; print RESULTS "$londeg.$lonmin,"; if ($lat eq "S") { print RESULTS "-"; }; print RESULTS "$latdeg.$latmin,-1,0,$quot$quot\n"; } print "Done; results should be in astrooutputfile.txt.\n"; sub RemoveZeroDecimal { $newstr=substr($_[0],0,100); $newstr=substr($newstr,2,100); return $newstr; } sub MakeIntoOneChar { $firstchar=substr($_[0],0,1); if ($firstchar==" ") { $secondchar=substr($_[0],1,1); return $secondchar; } return $_[0]; }