Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging Individuals Within Same Gedcom #320

Open
twcardenas opened this issue Dec 31, 2021 · 4 comments
Open

Merging Individuals Within Same Gedcom #320

twcardenas opened this issue Dec 31, 2021 · 4 comments

Comments

@twcardenas
Copy link

Is there currently a cli command that can merge two individual nodes within the same Gedcom file and output it to a new file?

@elliotchance
Copy link
Owner

In theory, it might be possible to filter the same file twice and merge and output to GEDCOM, but I seriously doubt this would work. Something like:

gedcomq -gedcom file.ged -gedcom file.ged -format gedcom \
  'Bob is Document1 | .Individuals | Only(.Name = "Bob Smith"); Robert is Document2 | .Individuals | Only(.Name = "Robert Smith"); MergeDocumentsAndIndividuals(Bob, Robert)' > merged.ged

I suspect even if this does not error, it won't be able to convert Bob/Robert to valid Documents for the merge.

Your best bet is to write this in go (or, if you're feeling ambitious, update the query language to accordingly)

@twcardenas
Copy link
Author

I'll take a look at giving that a go and updating it to do that.

When I started to query for a specific person using the Pointer

 .\gedcom query -gedcom file.ged '.Individuals | Only(.Pointer = "I2")'

The output was

2021/12/31 12:55:51 ERROR: no such variable I2

Does the search not work for this field?

@twcardenas
Copy link
Author

I also tried

.\gedcom query -gedcom .\file.ged ' .Individuals | Only(.Identifier != "@I1@")'

And get

2021/12/31 13:11:30 ERROR: expected EOF but found (

@elliotchance
Copy link
Owner

elliotchance commented Jan 1, 2022

On Mac, it seems to be working correctly:

elliot@Elliots-MBP bin % ./gedcom query -gedcom ancestry.ged '.Individuals | Only(.Pointer = "P323") | Length' 
1
elliot@Elliots-MBP bin % ./gedcom query -gedcom ancestry.ged '.Individuals | Only(.Pointer != "P323") | Length'
387

I just found on windows the terminal doesn't accept this syntax for double quotes: https://stackoverflow.com/questions/7760545/escape-double-quotes-in-parameter

I think you need to escape the double quotes:

 .\gedcom query -gedcom file.ged '.Individuals | Only(.Pointer = \"I2\")'

Or this?

 .\gedcom query -gedcom file.ged ".Individuals | Only(.Pointer = ""I2"")"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants