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 sgfvarsplit.

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

sgfvarsplit

% sgfvarsplit [-g#] [-v#] [-d#] [-s#] [-z] [-x prefix] [-F format] [files]

The utility sgfvarsplit reads an SGF file containing a game and splits it into files each containing a single variation. The output files get names produced from a format, by default "var-%03d.sgf" and a counter that counts from 1: var-001.sgf, var-002.sgf, ...

Options:

-g N
The input SGF might contain several games. This option selects game number N. The default is 1.
-v N
By default, all variations are extracted. This asks for variation N only. The filename is the same as it would have been without this option.
-d ARG
Use an output counter that is zero padded to ARG digits.
(Default is 3. Use -d0 to get numbers without zero padding.)
-s ARG
Start counting from ARG. (Default is 1.)
-z
Start counting from 0.
-x ARG
Use "ARG" as prefix. (Default is "var-".)
-F ARG
Use "ARG" as format. (Default is "var-%03d.sgf".)
The format must contain precisely one integer conversion.

Examples

% sgftopng -info tesujilecture7.sgf
Game #1
var 1: (1-0 (1-1 (2-3 (4-11)
var 2:                (4-4 (5-10)
var 3:                     (5-5 (6-13)
var 4:                          (6-6)))
...
var 31:                     (9-12)))))

% sgfvarsplit < tesujilecture7.sgf
% ls -1 v*
var-001.sgf
var-002.sgf
...
var-031.sgf

% sgfvarsplit -x Kogo- -v 7687 "Kogo's Joseki Dictionary.sgf"
% ls -1 K*
Kogo's Joseki Dictionary.sgf
Kogo-7687.sgf