Answers.Body: <p>Scid vs PC requires [Black &quot;AN Other1&quot;] [White &quot;AN Other2&quot;] [Result &quot;&quot;].<br />
  Since this was cloned from SCID I'm pretty sure SCID will be the same. I suggest you write a simple program to add these 3 header fields with the [Result] field matching the result at the end of the game.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-30T20:11:20.337Z
Answers.LastActivityDate: 2020-06-30T20:11:20.337Z
Answers.UserDisplayName: Brian Towers
Answers.Body: <p>You can use <code>sed '/Result/c[Result &quot;&quot;]' my.pgn &gt; no_results.pgn</code> to replace lines containing the string <code>Result</code> with whatever you want the line to be. You can adopt this for whatever else you want to replace. You want to keep the <code>c</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-30T20:25:03.227Z
Answers.LastActivityDate: 2020-06-30T20:25:03.227Z
Answers.UserDisplayName: Arne
Answers.Body: <p>You can always copy the pure text from a PGN manually, but that only works for one game.</p>
  <p>For more games I am not sure, and unfortunately most chess software is for windows.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-30T20:07:03.903Z
Answers.LastActivityDate: 2020-06-30T20:07:03.903Z
Answers.UserDisplayName: David Miedema
Answers.Body: <p>Thanks for your compliment about <a href="https://www.cs.kent.ac.uk/%7Edjb/pgn-extract/" rel="noreferrer">pgn-extract</a> (I am its author). You might be able to make the task a little easier by adding <code>--linelength 1000</code> to the argument list in order to get each game on a single line, then use sed to add an unknown result to the end of the game and re-process the game with pgn-extract to add an empty 7-tag roster. Finally, use sed again to edit the White and Black tags.</p>
  <p>The resulting command would look something like the following, although sed experts might be able to clean it up a bit:</p>
  <pre><code>pgn-extract -t filter_for_naked --noresults --notags --nocomments --noduplicates -bl20 --linelength 1000 my.pgn | sed -e 's/..*/&amp; */' | pgn-extract -7 | sed -e 's/White &quot;?&quot;/White &quot;AnonW&quot;/;s/Black &quot;?&quot;/Black &quot;AnonB&quot;/' &gt; naked.pgn
  </code></pre>
  <p>You will get some error reports for games that end in mate having inconsistent results but you can hide those in a logfile.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-01T07:28:10.023Z
Answers.Text: Thank you so much David! both for pgn-extract and the working command, it gave me exactly what I was looking for. Big help in my chase for improvement.
Answers.UserDisplayName: Purefan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-01T08:15:34.623Z
Answers.Text: You are welcome!
Answers.UserDisplayName: kentdjb
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-01T06:45:00.420Z
Answers.LastActivityDate: 2020-07-01T06:45:00.420Z
Answers.UserDisplayName: kentdjb
Body: <p>I'm a big fan of pgn-extract, but I am open to other linux-friendly tools. I have a big pgn file (over 5 million games) and a set of ECO codes. My goal is to fetch all the games matching those ECO codes, but with removing or fuzzying the players names and ratings, the year played, and the game result.</p>
  <p>I then plan to open a random game with Scid and analyze it, since removing the players' data and game result will help me avoid any bias.</p>
  <p>So far Im using pgn-extract like this:
  <code>pgn-extract -t filter_for_naked --noresults --notags --nocomments --noduplicates -bl20 --output naked.pgn my.pgn</code></p>
  <p>But Scid is having problems opening the file. As expected each game is just the set of moves (no headers at all) and I suspect Scid requires at least some headers.</p>
  <p>Any advise on how to use pgn-extract or Scid to achieve this?</p>
  
Tags: <software><programming><scid><linux>
Title: Extract anonymized games out of a pgn
ThreadText: # Extract anonymized games out of a pgn
  
  (Asked by: username_0 on 2020-06-30)
  
  I'm a big fan of pgn-extract, but I am open to other linux-friendly tools. I have a big pgn file (over 5 million games) and a set of ECO codes. My goal is to fetch all the games matching those ECO codes, but with removing or fuzzying the players names and ratings, the year played, and the game result.
  
  I then plan to open a random game with Scid and analyze it, since removing the players' data and game result will help me avoid any bias.
  
  So far Im using pgn-extract like this:
  `pgn-extract -t filter_for_naked --noresults --notags --nocomments --noduplicates -bl20 --output naked.pgn my.pgn`
  
  But Scid is having problems opening the file. As expected each game is just the set of moves (no headers at all) and I suspect Scid requires at least some headers.
  
  Any advise on how to use pgn-extract or Scid to achieve this?
  
  **Tags:** software, programming, scid, linux
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_4 on 2020-07-01. Score: 9 | Accepted answer
  
  Thanks for your compliment about pgn-extract (I am its author). You might be able to make the task a little easier by adding --linelength 1000 to the argument list in order to get each game on a single line, then use sed to add an unknown result to the end of the game and re-process the game with pgn-extract to add an empty 7-tag roster. Finally, use sed again to edit the White and Black tags.
  The resulting command would look something like the following, although sed experts might be able to clean it up a bit:
  pgn-extract -t filter_for_naked --noresults --notags --nocomments --noduplicates -bl20 --linelength 1000 my.pgn | sed -e 's/..*/& */' | pgn-extract -7 | sed -e 's/White "?"/White "AnonW"/;s/Black "?"/Black "AnonB"/' > naked.pgn
  
  You will get some error reports for games that end in mate having inconsistent results but you can hide those in a logfile.
  
  > **Comments:**
  > **username_0**: Thank you so much David! both for pgn-extract and the working command, it gave me exactly what I was looking for. Big help in my chase for improvement.  
  > **username_4**: You are welcome!  
  
  ---
  
  ### Answer by username_1 on 2020-06-30. Score: 3
  
  Scid vs PC requires [Black "AN Other1"] [White "AN Other2"] [Result ""].  
  Since this was cloned from SCID I'm pretty sure SCID will be the same. I suggest you write a simple program to add these 3 header fields with the [Result] field matching the result at the end of the game.
  
  
  ---
  
  ### Answer by username_2 on 2020-06-30. Score: 2
  
  You can use `sed '/Result/c[Result ""]' my.pgn > no_results.pgn` to replace lines containing the string `Result` with whatever you want the line to be. You can adopt this for whatever else you want to replace. You want to keep the `c`.
  
  
  ---
  
  ### Answer by username_3 on 2020-06-30. Score: 1
  
  You can always copy the pure text from a PGN manually, but that only works for one game.
  
  For more games I am not sure, and unfortunately most chess software is for windows.
  
  
  ---
  
  