aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/split-speedtest1-script.sh
blob: c7dae3eb689b9e346f89da9e14e22f98d3d9dc07 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
# Expects $1 to be a (speedtest1 --script) output file. Output is a
# series of SQL files extracted from that file.
infile=${1:?arg = speedtest1 --script output file}
testnums=$(grep -e '^-- begin test' "$infile" | cut -d' ' -f4)
#echo testnums=$testnums
for n in $testnums; do
  ofile=$(printf "speedtest1-%03d.sql" $n)
  sed -n -e "/^-- begin test $n\$/,/^-- end test $n\$/p" $infile > $ofile
  echo -e "$n\t$ofile"
done