smart way to batch make a lot of sgf files anonymous?

General conversations about Go belong here.
Post Reply
User avatar
eyecatcher
Dies with sente
Posts: 74
Joined: Sat Feb 26, 2011 1:14 am
Rank: kgs 5 kyu
GD Posts: 0
Universal go server handle: eyecatcher
Location: Germany
Has thanked: 141 times
Been thanked: 19 times

smart way to batch make a lot of sgf files anonymous?

Post by eyecatcher »

I love to replay pro-games, and to read personal stories about pro players... some pro players i like more than others, for example my most favorite players are: Go Seigen and Seo Pong-su, maybe as well Sakata Eio.
But actually i think i don`t really like them because of their style, or only based on what i read about their style, not what i really saw in their games.

The story goes like this:

I want to make a lot of sgf files from my (gogood / go4go) database anonymous and than replay games and rate them ... in the end, after a few weeks i want to (with the fuseki search of smartgo) look by whom the games where really played and see who`s games i really liked most ... only based on the games, not distracted by any personal emotions or Sympathie.

The question is here:
is here anyone who can tell me if there is a smart way, to delete the players info in sgf files automated? without opening one after the other with a texteditior or smartgo windows?
“Play where you want and don’t be afraid. If you’re chasing the dream you must take the risk.” Yasumasa Hane 9p
User avatar
eyecatcher
Dies with sente
Posts: 74
Joined: Sat Feb 26, 2011 1:14 am
Rank: kgs 5 kyu
GD Posts: 0
Universal go server handle: eyecatcher
Location: Germany
Has thanked: 141 times
Been thanked: 19 times

Re: smart way to batch make a lot of sgf files anonymous?

Post by eyecatcher »

Ohh, actually there is a quite ok way to do it in smartgo windows (not mac) without any other software... i did not knew that you can edit more player info than only one... normally i use the mac version, so i forgot how powerful the windows version is.
“Play where you want and don’t be afraid. If you’re chasing the dream you must take the risk.” Yasumasa Hane 9p
macelee
Lives in sente
Posts: 928
Joined: Mon Dec 31, 2012 1:46 pm
Rank: 5 dan
GD Posts: 0
KGS: macelee
Location: UK
Has thanked: 72 times
Been thanked: 480 times
Contact:

Re: smart way to batch make a lot of sgf files anonymous?

Post by macelee »

If you can compile 'sgfutils' on your system, you can achieve what you want by looping through your SGF files and do:

./sgfstrip -t PB -t PW xxx.sgf
mongus
Dies with sente
Posts: 122
Joined: Thu Mar 31, 2016 3:39 am
Rank: 12kyu
GD Posts: 0
Has thanked: 20 times
Been thanked: 13 times

Re: smart way to batch make a lot of sgf files anonymous?

Post by mongus »

On a Mac or other unix you could use sed :

Code: Select all

sed -i .original 's/\(P[WB]\)\[[^]]*]/\1[]/g' *.sgf
Mike Novack
Lives in sente
Posts: 1045
Joined: Mon Aug 09, 2010 9:36 am
GD Posts: 0
Been thanked: 182 times

Re: smart way to batch make a lot of sgf files anonymous?

Post by Mike Novack »

The question is here:
is here anyone who can tell me if there is a smart way, to delete the players info in sgf files automated? without opening one after the other with a texteditior or smartgo windows?

"Translation" of some of your answers:

Instead of manually opening one at a time and editing manually one at a time you could use a BATCH PROCESS. A "script" selecting the files to be edited and feeding them to a batch editor. You might not have these tools available on your computer, but as they point out, any 'nix OS would with its "shell language" and the standard utility library.

Obviously some learning involved if you have never done this sort of thing before. So the answer to your question (literal answer) is yes, there is such a way, but whether that is useful to you would depend on getting a 'nix OS installed and learning how to use the shell language and utilities.

Of course also possible without the 'nix tools if you have ANY programming language available on your computer and know how to code in it. But that is even more learning/work.

PS: Obviously also true -- some of us here might simply give you the necessary script and utility control which you could then just run. As pointed out, besides the more obvious 'nix OS's, the Macs are actually running a 'nix under the hood (I think a form of BSD) which you could access at the command line << though I know of few Mac users who ever use the command line >>
Uberdude
Judan
Posts: 6727
Joined: Thu Nov 24, 2011 11:35 am
Rank: UK 4 dan
GD Posts: 0
KGS: Uberdude 4d
OGS: Uberdude 7d
Location: Cambridge, UK
Has thanked: 436 times
Been thanked: 3718 times

Re: smart way to batch make a lot of sgf files anonymous?

Post by Uberdude »

mongus wrote:On a Mac or other unix you could use sed :

Code: Select all

sed -i .original 's/\(P[WB]\)\[[^]]*]/\1[]/g' *.sgf


Fun fact of the day: sed was written Lee McMahon, whose surname is probably well known to Go players for the McMahon pairing system used in many amateur Go tournaments (though his system was originally for a club ladder and then used as a tournament system by Brits).
User avatar
eyecatcher
Dies with sente
Posts: 74
Joined: Sat Feb 26, 2011 1:14 am
Rank: kgs 5 kyu
GD Posts: 0
Universal go server handle: eyecatcher
Location: Germany
Has thanked: 141 times
Been thanked: 19 times

Re: smart way to batch make a lot of sgf files anonymous?

Post by eyecatcher »

Mike Novack wrote:Obviously some learning involved if you have never done this sort of thing before.


apart from having some html basic back in high school and some very very "google and copy paste" programming for my self hosted wordpress...

no, i know what you are talking about, but it is too complicated for me to get into this kind of script thing.

I found a way in smartgo anyway, i thought i could not be done in smartgo, but it is working.

Thank you all.
“Play where you want and don’t be afraid. If you’re chasing the dream you must take the risk.” Yasumasa Hane 9p
Post Reply