in reply to Converting GEDCOM files

Perl is very well-suited to doing text manipulations. A script to do this conversion might look something like this:
#!/usr/local/bin/perl -w use strict; $/ = 'SOUR'; # read in one record at a time $^I = '.bak'; # modify input files in place, save originals with .bak my %convert = ( HEAL => 'Medical', HIST => 'Biography', EDUC => 'Educated', RESI => 'Resided', OCCU => 'Occupation', ); my $convert_re = join '|', keys %convert; $convert_re = qr/\b($convert_re)\b/; while (<>) { s/$convert_re/NOTE $convert{$1}:/g; s/1 NAME data/1 TITLE/; s/1 NAME data/1 TEXT/; s/1 NAME data/2 CONT/g; } continue { print; }
I expect I haven't gotten that quite right. (Does '1 NAME data' appear in the file literally, or is that what certain strings in the file look like?) It would be very helpful to see a snippet of the input file. :) Anyway, that should get you started.

Replies are listed 'Best First'.
Re: Re: Converting GEDCOM files
by Joes (Acolyte) on Jul 08, 2001 at 03:53 UTC
    Thanks Chipmonk -your offer is very much appreciated. I am brand new to this Monastery, so how do I contact you to send a sample .ged file, and one showing the expected outcome? Joe Email: slaven01@ozemail.com.au