Answers.Body: <p>To a limited extent, you can do something like this already using the -Tp argument which selects games by a particular player. So:</p>
  
  <p>pgn-extract -TpLeko --output Leko.pgn games.pgn</p>
  
  <p>but there is not currently (2018.12.19) a way to have the file names generated automatically from the contents of the source file. Without a way to bound the number of players of interest this would require a lot of file opening and closing for a large input file. Some thought would also need to be given to how player names are mapped to file names.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-19T07:49:42.243Z
Answers.LastActivityDate: 2018-12-19T07:49:42.243Z
Answers.UserDisplayName: kentdjb
Body: <p>How can I use PGN-Extract to split a multi-game pgn into separate files with just one game per file.  With the pgn being named for the opponents?  Like opponentA-opponentB.pgn</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-19T03:44:52.407Z
Comments.Text: Best to email Kent, the author. He's quite responsive.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-19T07:16:42.090Z
Comments.Text: As SmallChess says, as the author of pgn-extract, I am happy to field questions about the program via email and entertain ways to add additional features.
Comments.UserDisplayName: kentdjb
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-19T14:16:16.490Z
Comments.Text: should be able to write some parser in python relatively quickly that splits file and saves each with separate name
Comments.UserDisplayName: Drako
Tags: <pgn>
Title: PGN-Extract output each game to a separate file with name like opponentA-opponentB.pgn
ThreadText: # PGN-Extract output each game to a separate file with name like opponentA-opponentB.pgn
  
  (Asked by: username_0 on 2018-12-19)
  
  How can I use PGN-Extract to split a multi-game pgn into separate files with just one game per file. With the pgn being named for the opponents? Like opponentA-opponentB.pgn
  
  **Tags:** pgn
  
  > **Comments:**
  > **username_1**: Best to email Kent, the author. He's quite responsive.  
  > **username_2**: As username_1 says, as the author of pgn-extract, I am happy to field questions about the program via email and entertain ways to add additional features.  
  > **username_3**: should be able to write some parser in python relatively quickly that splits file and saves each with separate name  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-12-19. Score: 1
  
  To a limited extent, you can do something like this already using the -Tp argument which selects games by a particular player. So:
  
  pgn-extract -TpLeko --output Leko.pgn games.pgn
  
  but there is not currently (2018.12.19) a way to have the file names generated automatically from the contents of the source file. Without a way to bound the number of players of interest this would require a lot of file opening and closing for a large input file. Some thought would also need to be given to how player names are mapped to file names.
  
  
  ---
  
  