Finding games with non-standard starting positions with pgn-extract

Discussion of chess software programming and technical issues.

Moderator: Ras

Jonathan003
Posts: 243
Joined: Fri Jul 06, 2018 4:23 pm
Full name: Jonathan Cremers

Finding games with non-standard starting positions with pgn-extract

Post by Jonathan003 »

I want to check this "tockeck.pgn":
[Event "Live Chess"]
[Site "Chess.com"]
[Date "2020.12.25"]
[Round "-"]
[White "HansOnTwitch"]
[Black "DanielDardha2005"]
[Result "0-1"]
[WhiteElo "2950"]
[BlackElo "2628"]
[SetUp "1"]
[CurrentPosition "rq2k2r/p1pn1pp1/2bp1n1p/4p3/2B1P2B/2P2N2/PPP1Q2P/2KR3R w kq -"]
[Timezone "UTC"]
[ECOUrl "https://www.chess.com/openings/Alekhine ... acy-Gambit"]
[UTCDate "2020.12.25"]
[UTCTime "21:14:08"]
[TimeControl "180"]
[Termination "DanielDardha2005 won - game abandoned"]
[StartTime "21:14:08"]
[EndDate "2020.12.25"]
[EndTime "21:17:50"]
[Link "https://www.chess.com/game/live/6058010434"]
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPP2P/RNBQKBNR w KQkq - 0 1"]

1.Nf3 Nf6 2.e4 e5 3.Nc3 Bb4 4.Bc4 Bxc3 5.dxc3 d6 6.Bg5 h6 7.Bh4 b5 8.Bxb5+
Bd7 9.Bc4 Bc6 10.Qe2 Nbd7 11.O-O-O Qb8 0-1

[Event "Live Chess"]
[Site "Chess.com"]
[Date "2019.08.21"]
[Round "-"]
[White "HansCoolNiemann"]
[Black "JakubPulpan"]
[Result "0-1"]
[ECO "A00"]

1.f3 Nf6 2.Nh3 e5 3.Nf2 d5 4.e4 Nc6 5.Bb5 Bc5 6.Bxc6+ bxc6 7.d3 dxe4 8.
dxe4 Bxf2+ 9.Kxf2 Qe7 10.Nc3 O-O 11.Be3 Ba6 12.Qe1 Rad8 13.Rd1 Rxd1 14.
Qxd1 Qb4 15.Qc1 Rd8 16.Rd1 Rb8 17.a3 Qb7 18.Na4 h6 19.Nc5 Qb5 20.Qd2 Bc8
21.b4 Be6 22.Qe2 Qxe2+ 23.Kxe2 Kf8 24.Nxe6+ fxe6 25.Bxa7 Ra8 26.Bc5+ Ke8
27.Ra1 Nd7 28.Be3 Nb8 29.a4 Na6 30.c3 Nb8 31.a5 Nd7 32.c4 c5 33.b5 c6 34.
a6 cxb5 35.cxb5 Nb6 36.Kd3 Nd7 37.Kc4 Kd8 38.Bxc5 Kc7 39.b6+ Nxb6+ 40.Kb4
Nd7 0-1
If I typ this in the command prompt:

Code: Select all

pgn-extract -nosetup tocheck.pgn -nothers.pgn > nosetup.pgn
Two output pgn files are created "nosetup.pgn" & "others.pgn"

But the two games are in the "nosetup.pgn" output
And the "others.pgn" output database is emty.

Do I do something wrong or is this a bug in pgn-extract?
abulmo2
Posts: 462
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Finding games with non-standard starting positions with pgn-extract

Post by abulmo2 »

The command is -nosetuptags, at least on my computer.
Richard Delorme
Jonathan003
Posts: 243
Joined: Fri Jul 06, 2018 4:23 pm
Full name: Jonathan Cremers

Re: Finding games with non-standard starting positions with pgn-extract

Post by Jonathan003 »

Thanks abulmo2

If I type this:

Code: Select all

pgn-extract -nosetuptags tocheck.pgn -nsetup.pgn > nosetup.pgn
Two output pgn files are created nosetup.pgn containing the two games
And setup.pgn which is empty.

So something still goes wrong
chesskobra
Posts: 348
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Finding games with non-standard starting positions with pgn-extract

Post by chesskobra »

Try --nosetuptags (long options are given with 2 dashes). I use it all the time, and works for me on linux.

pgn-extract --nosetuptags input.pgn -o nosu.pgn -n su.pgn
Jonathan003
Posts: 243
Joined: Fri Jul 06, 2018 4:23 pm
Full name: Jonathan Cremers

Re: Finding games with non-standard starting positions with pgn-extract

Post by Jonathan003 »

Thanks chesscobra.

This also works:
pgn-extract --nosetuptags tocheck.pgn -nsetup.pgn > nosetup.pgn
or this
pgn-extract --nosetuptags tocheck.pgn -onosetup.pgn -nsetup.pgn


It is strange that I don't get an error message, but a wrong ouput if I type:
pgn-extract -nosetuptags tocheck.pgn -nsetup.pgn > nosetup.pgn
chesskobra
Posts: 348
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Finding games with non-standard starting positions with pgn-extract

Post by chesskobra »

I think there is no error in the way you called. When you pass -nosetuptag (with 1 dash), it is treated as the -n option with file name osetuptag. Then later when you pass -n other.pgn, it overrides -n osetuptag. But since --nosetuptags is not passed and no other filter is passed, it matches all games, and other.pgn is empty. If you passed -n other.pgn -nosetuptag, then you would get osetuptag as the empty file. I have not tested and haven't looked at the code, but most likely this is what is happening.