[Chugalug] gedit vs geany

rdflowers base at chalice.us
Thu Dec 20 19:49:24 UTC 2012


Yes, the .bla is sort of an id -- it is the ancestor number of that  
ancestoris my personal demented numbering system.

However, it has to this point been created and maintained totally by  
hand. When I find more than one theory of someone's parentage, I  
generally keep both. I can't give the alternate theories just any  
number because they might look arbitrary, but they are not.

I haven't yet, but I will look at the code you so kindly sent, in  
order to learn from it.

By ceaseless experimentation, I got as far as the following ( as an  
interim learning exercise ). It chops the line into pieces enough to  
give me the first fnumber in an '((' group.I'm sure it is not the best  
-- simplest -- regex to do that, so don't laugh too hard.

#!/usr/bin/perl

# print all the lines that contain '(('

while (<>) {
  if (       
m#(\(\()([^(0-9a-kLm-v)]*)([0-9a-kLm-v]+[w-z]+[@^]?)([^\)]*)(\)+?)(.*)(\/.*\/)(.*)#    
)
   {  print "1:",$1," 2:",$2," 3:",$3," 4:",$4," 5:",$5," 6:",$6,"  
7:",$7," 8:",$8,"   LINE:",$_ ;
   }
}




----- Message from danlyke at flutterby.com ---------
     Date: Thu, 20 Dec 2012 08:39:41 -0800
     From: Dan Lyke <danlyke at flutterby.com>
Reply-To: Chattanooga Unix Gnu Android Linux Users Group  
<chugalug at chugalug.org>
  Subject: Re: [Chugalug] gedit vs geany
       To: Chattanooga Unix Gnu Android Linux Users Group  
<chugalug at chugalug.org>


> So there are things about this file that I'm not understanding, I
> thought that the '.bla' starting a line was an ID, and the following
> script shows a lot of duplicates of those, but a start on parsing this
> might look like:
>
> #!/usr/bin/perl -w
> use warnings;
> use strict;
>
> open my $fh, '<', 'gnotes'
>     || die "Unable to open gnotes";
>
> my $generation;
> my $generationDates;
> my $people = {};
>
> while (my $line = <$fh>)
> {
>     chomp $line;
>     my $lineNumber = $.;
>
>     if ($line =~ /^\s*\;.*?\s+GENERATION\s+(\d+)?/)
>     {
>         $generation = $1;
>         $generationDates = undef;
>
>         if ($line =~ /(\d{4})\-(\d{4})/)
>         {
>             $generationDates = [$1,$2];
>         }
>     }
>     elsif ($line =~ /^\s*\;/)
>     {
>          # unrecognized comment line
>     }
>     elsif ($line =~ /^\.(\S*)\s+(.*?)?\s*\;\;/)
>     {
>          my ($id1, $lineageNotSure) = ($1,$2);
>     my ($stuff, $name, $dates) = split /\;\;/, $line;
>     my ($familyName, $maidenName);
>     $familyName = $1 if ($name =~ /\/(\w+)\//);
>     $maidenName = $1 if ($name =~ /\((\w+)\)/);
>
>     if ($people->{$id1})
>     {
>             print "Duplicate ID at line $lineNumber: $line\n   was  
> $people->{$i\
> d1}->{line}\n";
>     }
>         else
>     {
>             $people->{$id1} =
>             {
>              line => $line,
>              name => $name,
>              dates => $dates,
>              lineage => $lineageNotSure,
>             };
>     }
>     }
>     elsif ($line =~ /^\.(\S*)\s+(\(+.*?\))\s*(.*)/)
>     {
>         my ($id1, $lineageNotSure,$nameAndStuff) = ($1,$2,$3);
>
>         if ($people->{$id1})
>         {
>             print "Duplicate ID at line $lineNumber: $line\n   was  
> $people->{$i\
> d1}->{line}\n";
>         }
>         else
>         {
>             $people->{$id1} =
>             {
>              line => $line,
>              name => $nameAndStuff,
>              lineage => $lineageNotSure,
>             };
>         }
>     }
>     elsif ($line !~ /^\s*$/)
>     {
>         print "Unrecognized line: $line\n";
>     }
> }
> _______________________________________________
> Chugalug mailing list
> Chugalug at chugalug.org
> http://chugalug.org/cgi-bin/mailman/listinfo/chugalug
>


----- End message from danlyke at flutterby.com -----



--
R. D. Flowers, Chattanooga, TN, USA
http://chalice.us/poe/




More information about the Chugalug mailing list