GEDCOM manipulation for one text tag (database transfer related)

13 views
Skip to first unread message

Ryan Noyes

unread,
Sep 18, 2021, 3:53:48 PM9/18/21
to BBEdit Talk
Seeking workflow advice for wrangling a genealogical GEDCOM file in such a way that content normally appearing within the red box in this screenshot, instead populates where the green box is. 

Use case: moving one database to another.  Simplified: genealogical software databases have a standardized catch-all field, called Notes (tagged NOTE in the GEDCOM itself) for entering text concerning a genealogical event, i.e. like a graduation.  The red box represents this field working as it should.

Some (not all) genealogy database programs also have a second field that basically does the same exact thing, which is ridiculous but that's beside the point.  This field is called Description in either of the two applications I wish to import my database into.  I need the info presently appearing as a "note" for a fact, to therefore become a Description for a fact instead.  I am not, and have never used this Description field except to export a short GEDCOM with some text in that field for this demonstration (and to learn how this field is tagged/coded in the text file itself).

Attaching a short GEDCOM and a screenshot to show how I wish the text boxed in red to become the text boxed in Green. 

Your ideas would be most welcomed on how to tackle this.  Thank you so much in advance!

Ryan
20210918.ged
scr 2021-09-18 at 2.58.44 PM.jpg

Christopher Stone

unread,
Sep 18, 2021, 4:15:01 PM9/18/21
to BBEdit-Talk
On Sep 18, 2021, at 14:19, Ryan Noyes <ryan.w...@gmail.com> wrote:
Seeking workflow advice for wrangling a genealogical GEDCOM file in such a way that content normally appearing within the red box in this screenshot, instead populates where the green box is.


Hey Ryan,

You did a good job explaining the problem and providing a sample to work with.  The only thing you left out was an actual example of the desired end result.

One has to guess what you want done with the NOTE field.

I'm assuming you want it left blank, but I don't like to assume...

Try this:

Find:

(?-i)^(\d+\h+OCCU\h+)(.+)((?s)(.+?)\n^\d+\h+NOTE\h)(?-s)(.+)

Replace:

\1\5\3


--
Best Regards,
Chris

Roger Moffat

unread,
Sep 18, 2021, 4:25:51 PM9/18/21
to bbe...@googlegroups.com
Chris

Thanks for this - I recommended Ryan to the geniuses on this list. I figured it would be possible, but didn’t know where to begin to think about it.

Once the text of the NOTE tag has been moved to the  1 OCCU line, the entire line

2 NOTE xxxxxxxx

can be deleted.

Roger

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/27B8C6DE-0020-4D34-AC36-63AF805B14E9%40gmail.com.

Christopher Stone

unread,
Sep 18, 2021, 5:25:43 PM9/18/21
to BBEdit-Talk
On Sep 18, 2021, at 15:19, Roger Moffat <roge...@gmail.com> wrote:

Thanks for this - I recommended Ryan to the geniuses on this list. I figured it would be possible, but didn’t know where to begin to think about it.

Once the text of the NOTE tag has been moved to the  1 OCCU line, the entire line

2 NOTE xxxxxxxx

can be deleted.


Hey Roger,

You bet.

Okay, try this:

Find:

^(\d+\h+OCCU\h+)(?:.+)(?s)(.+?)^\d+\h+NOTE\h+(?-s)(.+)\n

Replace:

\1\3\2

* This pattern is a bit different than the original.  RegEx101.com didn't like the original, so I made a few changes.

You can get a better idea of how it works by looking on RegEx101:



BBEdit's Pattern Playground is a good place to experiment as well.

--
Best Regards,
Chris

Reply all
Reply to author
Forward
0 new messages