SgfStrip
Chris Hayashida: I always found that the SGF files from KGS/CGoban2 were annoying because of the circles...Anyway, here is my answer:
#!/usr/bin/perl # # sgfstrip.pl # by Chris Hayashida # # Usage: perl sgfstrip.pl <input filename> > <output filename> # # This script removes the CR and time tags from the KGS SGF # files. It can also accept input from standard input and send # output to standard output.
while (<>) { s/CR\[..\]//g; s/WL\[.*?\]//g; s/BL\[.*?\]//g; print; }
This Perl script will remove the CR, and WL/BL (time) tags from the SGF file. I had a version that also did comments (C tag) so that I could load SGF files from KGS et al. into PilotGOne.
Hope this helps someone.
uncomment.pl
Thanks the sgfstrip script I was encouraged to write the following simple script to remove all the comments from a sgf file. Not only related to KGS files.
#!/usr/bin/perl # # uncomment.pl # by Frankmartin Wiethuechter # # Usage: perl uncomment.pl <input filename> > <output filename> # # This script removes all C tags from SGF files. # It can also accept input from standard input and send # output to standard output.
while (<>) { s/C\[.*?\]//g; print; }
I use the script to port commented problem sgf files to files for a problem player like HactarGo.
This issue has been discussed a while ago - a page "CR Marks on Moves" seems to have gone, but see also Cgoban problems and solutions and rgg