>>I basically want to search for "0 @000#@ INDI" and upon each find
>>replace "000#" with an incremental integer on each consecutive find
>>start at 0001, 0002, 0003, etc.
>>
>>Can someone kick start my brain?

I just exported a Gedcom file from some an online family tree thing
I've been playing with and did this to see how it might work.

Maybe this does what you want, or sparks some ideas.

My file started out looking like this:

----
0 HEAD
1 FILE familytree-Larson.ged
1 SOUR VERWANDT
2 VERS 1.0
< bunch of vendor info stripped>
1 GEDC
2 VERS 5.5.1
2 FORM LINEAGE-LINKED
< other metadata stripped>
0 @166862805@ INDI
1 SEX F
1 NAME Jxxx /Larson/
2 GIVN Jxxx
2 SURN Larson
1 RIN 166862805_4
1 CHAN
2 DATE 11 AUG 2008
3 TIME 23:20:27
1 FAMC @20@
0 @166862881@ INDI
1 SEX F
1 NAME Lxxx /Larson/
2 GIVN Lxxx
2 SURN Larson
1 RIN 166862881_3
<etc>
----

My steps:

Find "\r", replace with "&*&".
Find "&*&0", replace with  "&*&\r0"

Now we've got every "record" on a single line.

---
0 @166862805@ INDI&*&1 SEX F&*&1 NAME Jxxx /Larson/&*&2 GIVN Jxxx&*&2
SURN Larson&*&1 RIN 166862805_4...
0 @166862881@ INDI&*&1 SEX F&*&1 NAME Lxxx /Larson/&*&2 GIVN Lxxx&*&2
SURN Larson&*&1 RIN 166862881_3..
0 @166861061@ INDI&*&1 SEX F&*&1 NAME Exxx /Larson/&*&2 GIVN Exxx&*&2
SURN Larson&*&1 RIN 166861061_4...
---

Select all the lines that contain "INDI" [in my file they're all
grouped together], and choose "Add Line Numbers".

---
1 0 @166862805@ INDI&*&1 SEX F&*&1 NAME Jxxx /Larson/&*&2 GIVN
Jxxx&*&2 SURN Larson&*&1 RIN 166862805_4...
2 0 @166862881@ INDI&*&1 SEX F&*&1 NAME Lxxx /Larson/&*&2 GIVN
Lxxx&*&2 SURN Larson&*&1 RIN 166862881_3..
3 0 @166861061@ INDI&*&1 SEX F&*&1 NAME Exxx /Larson/&*&2 GIVN
Exxx&*&2 SURN Larson&*&1 RIN 166861061_4...
...
53 0 @177839905@ INDI&*&1 SEX F&*&1 NAME Axxx /Sxxxxx/&*&2 GIVN
Axxx&*&2 SURN Sxxxx&*&1 DEAT...
54 0 @166860479@ INDI&*&1 SEX F&*&1 NAME Cxxxx /Pxxxx/&*&2 GIVN
Cxxxx&*&2 SURN Pxxxx&*&1 RIN 166860479_4...
55 0 @166864103@ INDI&*&1 SEX F&*&1 NAME Kxxx /Rxxxxx/&*&2 GIVN
Kxxx&*&2 SURN Rxxxxx&*&1 RIN 166864103_4...
---

My sample file had 55 people in it.

Now select various subsets of the lines and "Prefix Lines" with a "0"
to pad them out to the same length:

---
0001 0 @166862805@ INDI&*&1 SEX F&*&1 NAME Jxxx /Larson/&*&2 GIVN
Jxxx&*&2 SURN Larson&*&1 RIN 166862805_4...
0002 0 @166862881@ INDI&*&1 SEX F&*&1 NAME Lxxx /Larson/&*&2 GIVN
Lxxx&*&2 SURN Larson&*&1 RIN 166862881_3..
0003 0 @166861061@ INDI&*&1 SEX F&*&1 NAME Exxx /Larson/&*&2 GIVN
Exxx&*&2 SURN Larson&*&1 RIN 166861061_4...
...
0053 0 @177839905@ INDI&*&1 SEX F&*&1 NAME Axxx /Sxxxxx/&*&2 GIVN
Axxx&*&2 SURN Sxxxx&*&1 DEAT...
0054 0 @166860479@ INDI&*&1 SEX F&*&1 NAME Cxxxx /Pxxxx/&*&2 GIVN
Cxxxx&*&2 SURN Pxxxx&*&1 RIN 166860479_4...
0055 0 @166864103@ INDI&*&1 SEX F&*&1 NAME Kxxx /Rxxxxx/&*&2 GIVN
Kxxx&*&2 SURN Rxxxxx&*&1 RIN 166864103_4...
---

Now search, using grep, for: "([0-9]*) (0 @).*(@ INDI.*)\r", replace
with "\2\1\3\r".

---
0 @0001@ INDI&*&1 SEX F&*&1 NAME Jxxx /Larson/&*&2 GIVN Jxxx&*&2 SURN
Larson&*&1 RIN 166862805_4...
0 @0002@ INDI&*&1 SEX F&*&1 NAME Lxxx /Larson/&*&2 GIVN Lxxx&*&2 SURN
Larson&*&1 RIN 166862881_3..
0 @0003@ INDI&*&1 SEX F&*&1 NAME Exxx /Larson/&*&2 GIVN Exxx&*&2 SURN
Larson&*&1 RIN 166861061_4...
...
0 @0053@ INDI&*&1 SEX F&*&1 NAME Axxx /Sxxxxx/&*&2 GIVN Axxx&*&2 SURN
Sxxxx&*&1 DEAT...
0 @0054@ INDI&*&1 SEX F&*&1 NAME Cxxxx /Pxxxx/&*&2 GIVN Cxxxx&*&2 SURN
Pxxxx&*&1 RIN 166860479_4...
0 @0055@ INDI&*&1 SEX F&*&1 NAME Kxxx /Rxxxxx/&*&2 GIVN Kxxx&*&2 SURN
Rxxxxx&*&1 RIN 166864103_4...
---

Finally, search for "&*&", replace with "\r":

---
0 @0001@ INDI
1 SEX F
1 NAME Jxxx /Larson/
2 GIVN Jxxx
2 SURN Larson
1 RIN 166862805_4...
0 @0002@ INDI
1 SEX F
1 NAME Lxxx /Larson/
2 GIVN Lxxx
2 SURN Larson
1 RIN 166862881_3..
0 @0003@ INDI
1 SEX F
1 NAME Exxx /Larson/
2 GIVN Exxx
2 SURN Larson
1 RIN 166861061_4...
...
---

In order to automate the padding of the numbers, you'll need to use a
script of some sort as mentioned.  If this is a one-off thing, maybe
this gets you close.

chazl

-- 
Chaz Larson - c...@jeck.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "supp...@barebones.com" 
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---

Reply via email to