mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-27 01:32:03 +00:00
27 lines
516 B
Bash
27 lines
516 B
Bash
#!/bin/bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
mkdir -p split
|
|
file=split/start.svx
|
|
kat=
|
|
|
|
while read line; do
|
|
line=$(echo $line | sed 's/\t/ /g')
|
|
line=$(echo $line | sed 's/ / /g')
|
|
s=$(echo $line | sed 's/^\*begin \([0-9]*\)$/\1/')
|
|
if [ "$s" == "$line" ]; then
|
|
echo "$line" \
|
|
| egrep -q -m 1 '^\*end [0-9]+$' \
|
|
|| (echo "$line" >> $file)
|
|
else
|
|
echo ">>$line<<"
|
|
echo ">>$s<<"
|
|
echo "*end $kat" >> $file
|
|
file=split/$s.svx
|
|
kat=$s
|
|
echo "Starting $kat"
|
|
echo "*begin $kat" > $file
|
|
fi
|
|
done
|