created a utils directory

This commit is contained in:
Armin Briegel
2021-04-21 11:30:58 +02:00
parent 448a11a1b6
commit 8ffc4dd88b
4 changed files with 1 additions and 0 deletions

27
utils/extractLabels.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/bin/zsh
label_re='^([a-z0-9\_-]*)(\)|\|\\)$'
endlabel_re='^( |\t);;$'
label_dir="fragments/labels"
IFS=$'\n'
in_label=0
current_label=""
while read -r line; do
if [[ $in_label -eq 0 && "$line" =~ $label_re ]]; then
label_name=${match[1]}
echo "found label $label_name"
in_label=1
fi
if [[ $in_label -eq 1 ]]; then
current_label=$current_label$'\n'$line
fi
if [[ $in_label -eq 1 && "$line" =~ $endlabel_re ]]; then
echo $current_label > "$label_dir/${label_name}.txt"
in_label=0
current_label=""
fi
done <./Installomator.sh