Chess Tools

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

main line
Posts: 60
Joined: Thu Jul 07, 2016 10:15 pm

Re: Chess Tools

Post by main line »

Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Chess Tools

Post by Guenther »

main line wrote:Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
Use pgn extract.
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Chess Tools

Post by Ferdy »

main line wrote:Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
Delete after 22nd move.

Code: Select all

pgn-extract.exe --plylimit 44 --output out_22_mygames.pgn mygames.pgn
Delete after 35th move.

Code: Select all

pgn-extract.exe --plylimit 70 --output out_35_mygames.pgn mygames.pgn
mygames.pgn is your orig file.

Download pgn-extract.exe at:
https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/

Sample output of 22nd move, be aware of Result 0-1 and the * at the end of moves, they are not consistent, but it cuts the moves well.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2010.07.28"]
[Round "?"]
[White "www"]
[Black "bbb"]
[Result "0-1"]
[ECO "B18"]

1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Bf5 5. Ng3 Bg6 6. h4 h6 7. h5 Bh7 8.
Bd3 Bxd3 9. Qxd3 Nf6 10. Nf3 e6 11. c4 Bb4+ 12. Bd2 a5 13. Bc3 Nbd7 14. Rd1
O-O 15. O-O Qc7 16. Rfe1 Rfd8 17. Qe2 Qf4 18. Ne5 Nxe5 19. dxe5 Ng4 20.
Rxd8+ Rxd8 21. Qf3 Qg5 22. Re4 Bxc3 *
Norm Pollock
Posts: 1056
Joined: Thu Mar 09, 2006 4:15 pm
Location: Long Island, NY, USA

Re: Chess Tools

Post by Norm Pollock »

main line wrote:Please give me the tool which can deleting moves in pgn database.
I want delete moves after move 22nd or 35th in every game from database
Using "truncate" from 40H-PGN tools in a command window:

truncate alpha.pgn 44

truncate alpha.pgn 70

use 44 because 22 moves translates to 44 plies, similar for 35 and 70

output is put into a temporary file "outU.pgn" which you will rename

download from
http://komodochess.com/pub/40H-pgn-utilities/
Updated links for 40H Tools and Databases
http://40Hchess.epizy.com
http://nk-qy.info/40h
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Chess Tools

Post by MikeGL »

Nordlandia wrote:
MikeGL wrote:I think this is an easy one even for a newbie/hobbyist programmer like me, as long as the format of clock contains a suffix 's' just like the below sample
PGN, all the program needs to do is collect all those numbers then add them up.
It's vital to include base time as well. For example "[TimeControl "300+5"]" in the pgn header. And add that time in the calculation too.
You mean an output that's something like:

Code: Select all

[TimeControl "300+5"] 9777  9788  19,565
for each game where:
Total Time used by White: 9777s
Total Time used by Black: 9788s
Total for this game: 19,565s

or in HH:MM:SS format?
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.
User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Chess Tools

Post by Nordlandia »

Mike: i prefer HH:MM:SS format :)
MikeGL
Posts: 1010
Joined: Thu Sep 01, 2011 2:49 pm

Re: Chess Tools

Post by MikeGL »

Nordlandia wrote:Mike: i prefer HH:MM:SS format :)
Would try and then post around this Sunday (Easter) or on Monday.
Time and skill constraints :)
I told my wife that a husband is like a fine wine; he gets better with age. The next day, she locked me in the cellar.
main line
Posts: 60
Joined: Thu Jul 07, 2016 10:15 pm

Re: Chess Tools

Post by main line »

Yes my file is "mygames.pgn", but what is the folder name where I need put this file "mygames.pgn" ?
main line
Posts: 60
Joined: Thu Jul 07, 2016 10:15 pm

Re: Chess Tools

Post by main line »

I downloaded it but when I press double click on trunkate.exe "command prompt" appears 0.1 second and gone and I can't put yours commands.
What is my mistake ? What do I do wrong?
Can you please tell me where I need put my file - games.pgn? in Document folder or in same folder where trunkate.exe is or maybe C:\Users\"My name" folder?
Norm Pollock
Posts: 1056
Joined: Thu Mar 09, 2006 4:15 pm
Location: Long Island, NY, USA

Re: Chess Tools

Post by Norm Pollock »

main line wrote:I downloaded it but when I press double click on trunkate.exe "command prompt" appears 0.1 second and gone and I can't put yours commands.
What is my mistake ? What do I do wrong?
Can you please tell me where I need put my file - games.pgn? in Document folder or in same folder where trunkate.exe is or maybe C:\Users"My name" folder?
1. unzip the download "40H-PGN-xxxxxxxx".
2. in command window, go to the folder where truncate.exe is located.
3. in command window, copy "truncate.exe" to folder where you have pgn file games.pgn
(or if you prefer, copy games.pgn to folder where truncate.exe is located)
3. in the command window, execute the command
truncate games.pgn

truncate.exe works only in a command window. clicking, or double-clicking, on its icon in windows explorer will not get it to work. you have to enter a command in the command window.
Updated links for 40H Tools and Databases
http://40Hchess.epizy.com
http://nk-qy.info/40h