in reply to Converting GEDCOM files
I can't quite get the jist of what you want with the SOUR part. As you are a fellow Aussie I will post a solution for you if you post: A sample of the SOURCE file with a corresponding example of how the OUTPUT should look. Add any notes before, after but not in the SOURCE and OUTPUT.
Here is some code to do the first bit you want. You will need perl to use this. For details on getting perl see New Monks part 7. Do you want the latest version of Perl?
#!/usr/bin/perl -w use strict; my @data; # define a hash of changes to be made my %change = ( HEAL => 'NOTE Medical:', HIST => 'NOTE Biography:', EDUC => 'NOTE Educated:', RESI => 'NOTE Resided:', OCCU => 'NOTE Occupation:', ); # accept input via three mechanisms # if no file specified here: my $file = ''; # then look for a command line argument here: $file = shift @ARGV unless $file; # if we still have no file to process # enter interactive mode here: unless ($file) { print "Please enter a file to process: "; chomp($file = <>); } # get the data open (FILE, "<$file") or die "Unable to open $file: $!"; @data = <FILE>; close FILE; # make the changes for (@data) { for my $key (keys %change) { s/$key/$change{$key}/g; } } # print the changes to a new file with the same name # as the original plus a .new suffix. open (FILE, ">$file.new") or die "Unable to write $file.new: $!"; print FILE @data; close FILE; print "Munged $file no worries!\n";
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Converting GEDCOM files
by Joes (Acolyte) on Jul 08, 2001 at 02:28 UTC | |
by tachyon (Chancellor) on Jul 08, 2001 at 04:52 UTC | |
by Joes (Acolyte) on Jul 08, 2001 at 09:12 UTC | |
by Anonymous Monk on Jul 09, 2001 at 14:34 UTC |