Compare pgn data quickly How?
Moderators: Elijah, Igbo, timetraveller
-
- Forum Contributions
- Points: 17 742,00
- Posts: 83
- Joined: 04/11/2019, 18:06
- Status: Offline (Active 13 Hours, 57 Minutes ago)
- Medals: 1
- Topics: 6
- Reputation: 160
- Has thanked: 385 times
- Been thanked: 292 times
Compare pgn data quickly How?
I have a question about pgn databases. Now and again, the need arises where I want to compare two similar pgn databases to highlight the exact differences between them and give the different games in a new pgn database.. How to do this quickly? Happy about suggestions
-
- Forum Contributions
- Points: 33 999,00
- Posts: 2585
- Joined: 05/02/2020, 10:42
- Status: Offline (Active 1 Month, 3 Days, 14 Hours, 41 Minutes ago)
- Medals: 2
- Topics: 194
- Reputation: 7481
- Has thanked: 6579 times
- Been thanked: 6863 times
Compare pgn data quickly How?
PGN files are basically text files so a text editor such as NotePad++ for example would have a Compare plugin which would allow you to compare two PGN files. You would still need to extract the differences or whatever you're looking for via regex. I wrote the regex code a while ago - regrettably my filing system is the PITS so unable to help.
I usually just alter the extension from pgn to txt and do whatever text manipulation I need to.
Edit : try WinMerge ..
I usually just alter the extension from pgn to txt and do whatever text manipulation I need to.
Edit : try WinMerge ..
-
- Forum Contributions
- Points: 17 742,00
- Posts: 83
- Joined: 04/11/2019, 18:06
- Status: Offline (Active 13 Hours, 57 Minutes ago)
- Medals: 1
- Topics: 6
- Reputation: 160
- Has thanked: 385 times
- Been thanked: 292 times
Compare pgn data quickly How?
Thanks Nemesis! WinMerge will do the task for .txt. NotePad++ is also good, however a little bit slow for several thousand games comparison.
-
- Inactive User
- Points: 64,00
- Posts: 17
- Joined: 05/07/2020, 4:23
- Status: Offline (Active 2 Weeks, 3 Days, 35 Minutes ago)
- Topics: 0
- Reputation: 32
- Has thanked: 1247 times
- Been thanked: 42 times
-
- Forum Contributions
- Points: 33 999,00
- Posts: 2585
- Joined: 05/02/2020, 10:42
- Status: Offline (Active 1 Month, 3 Days, 14 Hours, 41 Minutes ago)
- Medals: 2
- Topics: 194
- Reputation: 7481
- Has thanked: 6579 times
- Been thanked: 6863 times
Compare pgn data quickly How?
Could you be a little more specific please Ivan ?
I was unable to find a flag/command line argument that compares PGN files.
-
- Chief moderators
- Points: 20 167,00
- Forum Contributions
- Posts: 227
- Joined: 14/08/2022, 20:09
- Status: Offline (Active 2 Hours, 32 Minutes ago)
- Medals: 1
- Topics: 8
- Reputation: 1784
- Has thanked: 360 times
- Been thanked: 1463 times
Compare pgn data quickly How?
Use SQL.Kater Carlo wrote: ↑09/09/2023, 13:05 I have a question about pgn databases. Now and again, the need arises where I want to compare two similar pgn databases to highlight the exact differences between them and give the different games in a new pgn database.. How to do this quickly? Happy about suggestions
Nguyen Hong Pham has produced an excellent SQL tool for PGNs called Open Chess Game Database Standard (OCGDB).
https://github.com/nguyenpham/ocgdb
It is lightning fast for large databases/multiiple PGNs. You can compare PGNs with ease once you learn basic SQL syntax (not hard for the vast majority of people). This is far superior to a text editor and is what I use along with the SQLite GUI. I believe Pham has built OCGDB into the Banksia GUI as well.
There is a large thread over at Talkchess on OCGDB.
https://talkchess.com/forum3/viewtopic.php?f=7&t=78464&hilit=ocgdb
-
- Forum Contributions
- Points: 11 599,00
- Posts: 314
- Joined: 15/11/2019, 19:53
- Status: Offline (Active 3 Hours, 20 Minutes ago)
- Medals: 1
- Topics: 5
- Reputation: 1036
- Location: French Polynesia
- Has thanked: 1125 times
- Been thanked: 968 times
Compare pgn data quickly How?
Hi,
Just install pgn-extract.exe in same directory as your .pgn databases and type command line :
pgn-extract -s 1.pgn -c2.pgn -D -o1minus2.pgn
It will remove duplicates games found in 2.pgn, from 1.pgn, and save result into 1minus2.pgn
Games are only considered to be duplicates on the basis of the moves played.
Also note that it is a subtraction, and not an "exclusive OR" . Therefore the games found in 2.pgn that are not it 1.pgn will not be in 1minus2.pgn
If you want to keep all the games from 1.pgn and 2.pgn but not the duplicates, you will to type 3 command lines :
pgn-extract -s 1.pgn -c2.pgn -D -o1minus2.pgn
pgn-extract -s 2.pgn -c1.pgn -D -o2minus1.pgn
copy /B 1minus2.pgn + 2minus1.pgn 1plus2no-dups.pgn
Best regards.
Just install pgn-extract.exe in same directory as your .pgn databases and type command line :
pgn-extract -s 1.pgn -c2.pgn -D -o1minus2.pgn
It will remove duplicates games found in 2.pgn, from 1.pgn, and save result into 1minus2.pgn
Games are only considered to be duplicates on the basis of the moves played.
Also note that it is a subtraction, and not an "exclusive OR" . Therefore the games found in 2.pgn that are not it 1.pgn will not be in 1minus2.pgn
If you want to keep all the games from 1.pgn and 2.pgn but not the duplicates, you will to type 3 command lines :
pgn-extract -s 1.pgn -c2.pgn -D -o1minus2.pgn
pgn-extract -s 2.pgn -c1.pgn -D -o2minus1.pgn
copy /B 1minus2.pgn + 2minus1.pgn 1plus2no-dups.pgn
Best regards.
-
- Forum Contributions
- Points: 17 742,00
- Posts: 83
- Joined: 04/11/2019, 18:06
- Status: Offline (Active 13 Hours, 57 Minutes ago)
- Medals: 1
- Topics: 6
- Reputation: 160
- Has thanked: 385 times
- Been thanked: 292 times
Compare pgn data quickly How?
@ConRog Your solution is brilliant and ultra fast . This is what I was looking for.
The SQL solution is a choice only for people, who use it already in their daily work, in my view.
It is definitely not simple. OCDGB gave problems to me and I do not like to read tons
of large threads, before I can start. Maybe it is only my problem.
WinMerge was new to me. It is also an interesting experience and of great value
for future analyses, however more time consuming.
The SQL solution is a choice only for people, who use it already in their daily work, in my view.
It is definitely not simple. OCDGB gave problems to me and I do not like to read tons
of large threads, before I can start. Maybe it is only my problem.
WinMerge was new to me. It is also an interesting experience and of great value
for future analyses, however more time consuming.
-
- Inactive User
- Points: 64,00
- Posts: 17
- Joined: 05/07/2020, 4:23
- Status: Offline (Active 2 Weeks, 3 Days, 35 Minutes ago)
- Topics: 0
- Reputation: 32
- Has thanked: 1247 times
- Been thanked: 42 times
Compare pgn data quickly How?
In the following example, we want to select games from 2.pgn that don't already exist in 1.pgn:
.\pgn-extract --checkfile 1.pgn -D -o 3.pgn 1.pgn 2.pgn