Last active
January 2, 2018 15:48
-
-
Save sunfish-shogi/d90c2b0e48747b9c3b1f2377d0aa3811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
SRC_DIR=$1 | |
DST_DIR=$2 | |
THRESHOLD=$3 | |
CNT=1 | |
for SRC_FILE in `find $SRC_DIR -type f -name '*.csa'`; do | |
NAME=`basename $SRC_FILE` | |
DST_FILE=`echo $DST_DIR/$NAME` | |
BLACK_RATE=`grep -m 1 "^'black_rate:" $SRC_FILE | sed "s/^.*://"` | |
WHITE_RATE=`grep -m 1 "^'white_rate:" $SRC_FILE | sed "s/^.*://"` | |
BLACK_RATE=`echo ${BLACK_RATE%.*}` | |
WHITE_RATE=`echo ${WHITE_RATE%.*}` | |
if [ $BLACK_RATE ] && [ $WHITE_RATE ] && [ $BLACK_RATE -gt $THRESHOLD ] && [ $WHITE_RATE -gt $THRESHOLD ]; then | |
echo $CNT $NAME | |
\cp $SRC_FILE $DST_FILE | |
fi | |
CNT=`expr $CNT + 1` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment