Thank you @Glorfindel . I didn't know about Chess Querry Language. It is indeed a wonderful tool. Going through basic syntax of CQL from their website, I came up with the following script and method that can pick out "Greek gift sacrifice" by either black or white from any pgn
database. I provide an example below using a UNIX system.
First, download a pgn database of your interest (example.pgn
).
Second, using a text editor save the following script as a text file greek_gift.cql
with the extension .cql
.
cql (input example.pgn)
flipcolor flip
next (Bh7
kh7)
Keep the executable cql
program (downloaded from the CQL website), the cql file greek_gift.cql
and the input pgn file example.pgn
in the same folder.
Open the terminal and navigate to the folder.
Execute the command ./cql greek_gift.cql
.
A new pgn file greek_gift-out.pgn
will be generated in the same directory. Note that this will contain games with Bh7 sacrifice by white as well as Bh2 sacrifice by black, followed by capture by the opponent king.
I am not a programmer; please edit the script if anybody thinks there is an error.