]> git.sesse.net Git - remoteglot-book/commitdiff
Make PGN partitioning work better with DOS-style line endings.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 12 Dec 2014 18:11:15 +0000 (19:11 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 12 Dec 2014 18:11:15 +0000 (19:11 +0100)
partition-pgn.sh

index 18a2020b38af61ab250508f23faf1e0db19e55a5..b23bc339872c249ddb8f158c620c5cd072936a7c 100755 (executable)
@@ -15,7 +15,7 @@ split_point() {
                echo $SIZE
        else 
                TENTATIVE_SPLIT_POINT=$(( SIZE * P / NUM ))
-               OFFS=$( tail -c +${TENTATIVE_SPLIT_POINT} "$FILE" | grep -b '^$' | head -n 1 | cut -d: -f1 )
+               OFFS=$( tail -c +${TENTATIVE_SPLIT_POINT} "$FILE" | grep -b '^\[Event ' | head -n 1 | cut -d: -f1 )
                if [ -z "$OFFS" ]; then
                        echo $SIZE
                else