Batch-editing game details on SGF files

For discussing go computing, software announcements, etc.
Post Reply
User avatar
PeterPeter
Lives with ko
Posts: 285
Joined: Wed Oct 03, 2012 1:11 am
GD Posts: 0
Location: UK
Has thanked: 42 times
Been thanked: 52 times

Batch-editing game details on SGF files

Post by PeterPeter »

I have dozens of my games saved on my computer, all as individual SGF files. To make this growing collection easier to manage, I want to use a database. I use Drago for most reviewing and editing, and that has a database option, so that was my first place to look.

The problem is that the information for each game (date, black player, white player, venue etc; would you call them "tags"?) is recorded differently by different playing sites and programs, so there is no consistency and lots of gaps.

Can anyone recommend a program that I could use to sort out these tags in batch? For example, Igo for Windows always labels me as "Human". I would like to highlight say 50 of those games, then in one operation, change all those tags to my real name.
Regards,

Peter
xed_over
Oza
Posts: 2264
Joined: Mon Apr 19, 2010 11:51 am
Has thanked: 1179 times
Been thanked: 553 times

Re: Batch-editing game details on SGF files

Post by xed_over »

sgf files are just plain text files, easily edited with any plain text editor.
there are a myriad of tools that can do simple search and replace of the text strings inside those files.
the simplest off the top of my head would be sed or perl or many other scripting languages.
User avatar
ez4u
Oza
Posts: 2414
Joined: Wed Feb 23, 2011 10:15 pm
Rank: Jp 6 dan
GD Posts: 0
KGS: ez4u
Location: Tokyo, Japan
Has thanked: 2351 times
Been thanked: 1332 times

Re: Batch-editing game details on SGF files

Post by ez4u »

If you are not the type of person that wants to learn perl in order to change a few lines of text, you can search the web with something like "windows text search and replace" or "windows grep equivalent" and find many gui-based programs for free. If you quite literally want to pick 11 *.sgf files out of a directory of 100 using your mouse (just like in windows explorer) and then search for "PB[human]" and replace it with "PB[that twit ez4u]" then you might like textrep, which seems to do exactly that. More commonly these programs will search all the *sgf files in your directory and do the replacement across the lot or via some filters that you specify rather than hand selecting the files. You might like dnGrep in that case. Note that I could search for, check the screenshots, download and install, and then test for myself about four of these programs in about an hour. There are quite a few out there and they're pretty easy to find.
Dave Sigaty
"Short-lived are both the praiser and the praised, and rememberer and the remembered..."
- Marcus Aurelius; Meditations, VIII 21
Post Reply