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 [-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, ...


-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.)
Start counting from 0.
-x ARG
Use "ARG" as prefix. (Default is "var-".)
Use "ARG" as format. (Default is "var-%03d.sgf".)
The format must contain precisely one integer conversion.


% 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*

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