sgfutils

The package sgfutils contains a few command line utilities that help working with SGF files that describe go (igo, weiqi, baduk) games. This page is about sgfcheck.

See also sgf, sgfcharset, sgfcmp, sgfdb, sgfdbinfo, sgfinfo, sgfmerge, sgfsplit, sgfstrip, sgftf, sgftopng, sgfvarsplit, sgfx, ugi2sgf.

sgfcheck

% sgfcheck [-okfn] [-nokfn] [-r] [-e ext] [infiles/indirs]
The program sgfcheck reads SGF files and checks them, muttering about flaws or possible flaws such as
premature eof
gametree must start with '('
gametree does not end with ')'
move property in root node
move and setup properties in the same node
duplicated tag
nonstandard RE property
KM and RE do not differ by an integer
not a valid move
play on nonempty position
moves 114 and 115 were both played by W
illegal ko recapture
cycle: position after move 286 equals that after move 278
suicide
mass suicide
Complaints are printed to stderr.

Options:

-r
There may be directories among the input files. Search them recursively for files with the specified extension (default: .sgf).
-e ext
(For recursive searches:) Set extension to ext. Use "" to search all regular files.
-okfn
Print filename to stdout if there were no complaints.
-nokfn
Print filename to stdout if there were complaints.
-noRE
Don't check RE field.
-noKM
Don't check KM field.
-Eresign
Do not mutter about "resigner played last move"

Examples:

% sgfcheck -r . 2>&1 | grep suicide
finds the games where a suicide occurs.
% sgfcheck -nokfn -r . 2>/dev/null | wc -l
counts how many game records are bad.