mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-12-13 09:27:11 +00:00
more obscure scripts found - to be documented
This commit is contained in:
26
noinfo/scripts/loser-caves1624-raw-data/split.sh
Normal file
26
noinfo/scripts/loser-caves1624-raw-data/split.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user