See also sgf, sgfcharset, sgfcheck, sgfcmp, sgfdb, sgfdbinfo, sgfinfo, sgfmerge, sgfsplit, sgftf, sgftopng, sgfvarsplit, sgfx, ugi2sgf.
% sgfstrip [-h] [-m] [-t] [-pw] [-pe] [-pass] tags < input > output
The utility sgfstrip reads an SGF file, strips it and writes it to stdout. Leading and trailing whitespace for all property values is removed. Properties with one of the given names (in all caps) are removed. Empty nodes are removed.
% sgfstrip BL WL < in.sgf > out.sgfStrip away all occurrences of BL and WL node properties.
% sgfstrip -t BL WL < in.sgf > out.sgfStrip away all occurrences of BL and WL node properties, except for those in the final node.
% sgfstrip -h -t C < in.sgf > out.sgfStrip away all comments, but leave those at start and end.
% cat in.sgf (;EV[ The game ](;B[aa]C[the actual game])(;B[tt]C[a variation])) % sgfstrip -t C < in.sgf (; EV[The game] (;B[aa] C[the actual game] ) (;B[tt]) )
It is possible to strip only those occurrences of a given tag whose value contains a given string.
% sgfstrip C:abc < in.sgf > out.sgfThis removes all comments that contain "abc". And
% sgfstrip C=abc < in.sgf > out.sgfwill remove only the comments that are precisely "abc".
% sgfmerge < in.sgf (; EV[ The game ] ;B[aa] C[the actual game] )
A general SGF utility cannot blindly strip empty properties. The properties B and W are used to indicate a pass. The standard also indicates that VW can be used to reset a restriction introduced by an earlier VW[here:there]. However, sgf will delete most empty properties. Comments and variations are stripped by sgf -c.