1

Anyone aware of a way to do a mass edit of the header in a pgn file that has multiple games?

Currently I've tried using pgn-extract and the line I have tried is:

pgn-extract -C -N -V -newfile.pgn oldfile.pgn

This does cleanup any annotations in the moves list but the header still remains the same.

Here's an example of a header. In the below header example, say I'd want to get rid of the "Round 29" portion .

[Event "F/S Return Match"] [Site "Belgrade, Serbia JUG"] [Date "1992.11.04"] [Round "29"] [White "Fischer, Robert J."] [Black "Spassky, Boris V."] [Result "1/2-1/2"]

1 Answer 1

3

You can do it with pgn-extract via a combination of the -R flag, to select the tags you want to retain (and their ordering), and the --xroster option to omit all those tags not listed in the roster file. For instance, if you want only White, Black and Result tags included with each game, place White, Black and Result (one per line) in a file called roster, say and then run pgn-extract as follows:

pgn-extract -C -N -V -R roster --xroster -newfile.pgn oldfile.pgn
1
  • Thank you! This worked! I'll look more at the flag commands in the future. Much appreciated!
    – hangejj
    Commented Sep 10, 2022 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.