summaryrefslogtreecommitdiffstats
path: root/bin/nethack/combine_ttyrecs
blob: 719cd3727ff8a761f3fb43b5ae4f64af3ec6e01b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

if [[ "$1x" == '-vx' ]]; then
    verbose=1
    shift
else
    verbose=0
fi

mkdir -p combined

filenum=0
for file in *.ttyrec; do
    if ttygrep 'welcome to NetHack!' $file | grep -q "ttyrec"; then
        filenum=$((filenum+1))
    fi
    if [[ $verbose -eq 1 ]]; then
        printf "%03d: %s\n" $filenum $file
    fi
    filename=$(printf "%03d\n" $filenum).ttyrec
    cat $file >> combined/$filename
done