Is there a way to sort a PGN chess game by date and export the sorted games as a new PGN file?
4 Answers
I have not tried this myself, but there is a forum post on chess.com that has instructions on how to do this in SCID (http://www.chess.com/forum/view/help-support/sorting-a-pgn)
- Make an empty scid database
- Import your games
- Do database maintenance - Sort by date
- Export your databse to PGN
-
The OP didn't ask what was the cheapest or the best tool, just if there was a way. Naturally, free is great. But I think Chessbase is worth the price. So I would stick with my answer regardless of cost.– ezaspiDec 18, 2013 at 4:14
I am sure there are many programs that include this functionality. I would be surprised if SCID (http://scid.sourceforge.net/) did not have it. There should be one or more online services that provide this function. In the end of the day, you can write your own script in e.g. Python that does this easily and nicely. The trick is that some games appear as duplicates in less well maintained PGN files. Another trick is that some games are missing certain annotation fields. Some fields could also be filled in with incorrect type of data or simply be empty. So if you go down the road of writing your own scripts, consider writing quality check scripts that make sure the PGN format is followed and that the information is complete.
-
-
@Kinderchocolate then you should include this information in your question: "I did not find a way to do this in Scid". Dec 16, 2013 at 7:54
-
If you can provide a bit more information, I can accept you as the answer.– ABCDDec 16, 2013 at 23:32
-
According to scid.sourceforge.net/help/Sorting.html, the sorted order is saved only for non-read-only Scid database files. So perhaps try to save your PGN database as a Scid database. Then sort the Scid database according to e.g. date. Then try to export this Scid database as a PGN file. Additionally, PGN files are plain text and have a clear format and date field. You could write a script (in e.g. Python) that sorts the file by date or try to search for such a script online. By the way, does ChessBase Light (free version) support this function? Dec 18, 2013 at 11:56
You can do it with ChessBase: http://chessbase-shop.com/en/products/chessbase12_download
-
You accepted this as the best answer? There should be many more ways that are free of charge. Chessbase 12 is an expensive software. Dec 15, 2013 at 1:20
-
2
-
@StudentT it is of course your right to choose which answer that suits you best :) Still, in my opinion, Chessbase is not the only way to go in terms of recording your games and taking care of them. Cheers. Oct 15, 2014 at 8:33
The accepted answer does currently (2021) not work with the latest Scid versions. Bug? But it works with Scid vs PC:
- In Scid vs PC, open the PGN database which you want to sort (File → Open).
- Open the game list, if it is not visible already (Windows → Game List).
- Create an empty Scid database via File → New (make sure it is a
*.si4
database, not a*.pgn
database). You should now see both database buttons below the game list. - Select the PGN database by clicking its button.
- Sort the PGN database by your desired criteria. You can do that directly in the game list by clicking on the column headers, or by doing it via Tools → Maintenance → Sort Database (you can reset any sorting by right-clicking a column header in the game list and choosing Reset).
- Drag-drop the button of the sorted PGN database on the button of the empty Scid database. This imports all games, sorted in the same order. Test it by resetting the sorting. The sorting should stay the same as in the sorted PGN database.
- Finally export the Scid database to a new PGN database using Tools → Export All Filter Games → Export Filter to PGN. I recommend to not set the encoding to utf-8, I encountered problems in other databases when I did that.
Voilà