How can I use pgn-extract to remove a game from a pgn file when there is an illegal move?

1 Answer 1


pgn-extract will do exactly that if you give it an input file and say where you want the correct games to go. For instance:

pgn-extract --output clean.pgn games.pgn

will put only the valid games from games.pgn into clean.pgn, reporting any errors on standard output. If you want to have a record of the errors then you can use the -l flag to specify a log file; e.g.:

pgn-extract --output clean.pgn -lissues.txt games.pgn

There are lots of additional options/flags described in the documentation.

Disclosure: I am the author of pgn-extract.

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.