View Full Version : Search and replace with Grep in BBEdit in a GEDCOM file

19 September 2005, 05:33 PM

from the Windows genealogical application The Master Genealogist I exported a GEDCOM file where the places are in the form
Detail, City, County, State, Country
So I have such tags:
2 PLAC St. Remy Abbey, Reims, Marne d

20 September 2005, 10:10 AM
I'm no GREP expert, but I'd use three separate replaces. Here's what I came up with:

Perform 3 times (to change middle place fields):
Search: ^(2 PLAC )(.*), ,
Replace: \1\2, replaced by BBEdit,

Perform once (to change first place field):
Search: ^2 PLAC ,
Replace: 2 PLAC replaced by BBEdit,

Perform once (to change last place field):
Search: ^(2 PLAC )(.*),( *)\r
Replace: \1\2, replaced by BBEdit\r

I can't find a way to format this to show a monospaced font for the code (similar to the code html tag), so it's hard to see the spaces.

Obviously, if you decide to try my suggestion, use a copy of the original file. When I'm trying to figure out a GREP pattern, I undo right after the replace if it didn't do what I expected and I make a change and try again. Somebody else might post a better suggestion, but this is what I came up with.

After you've made your changes, you can use BBEdit to compare the original and modified files. (Search>Compare Two Front Documents)


21 September 2005, 02:03 PM
Thank you very much Michael!

It works very good.
Now I can replace in Reunion replaced by BBEdit with no letter and I have the places in the form I need to export back.

Thank you again,
Marian Boangiu