diff --git a/shell-scripts.d/tercet-tags.sh b/shell-scripts.d/tercet-tags.sh
index ccb0a99..8f985ec 100755
--- a/shell-scripts.d/tercet-tags.sh
+++ b/shell-scripts.d/tercet-tags.sh
@@ -7,16 +7,18 @@ echo -e "\nAdding terzina tags and numbers."
for file in *;
do
- if [[ "$file" != 'tercet-tags.sh' ]]; then # exclude this script
+ if [[ "$file" != tercet-tags.sh ]] && [[ "$file" != canticle-to-xml.sh ]]; then # exclude this script
if [[ "$file" != sed* ]]; then # exclude sed file made later
echo -e "Modifying $file"
# Every third line (mod 3) add a closing tag, newline, and opening tag.
# TODO
# How many tabs to add?
- awk -i inplace '{print}; NR % 3 == 0 {print "\t\t\n\t\t"}' "$file"
+ awk -i inplace '{print}; NR % 3 == 0 {print "\t\t\t\t\n\t\t\t\t"}' "$file"
# Add an opening tag at the beginning and a closing tag at the end because the above awk doesn't.
- sed -i '1s/^/\t\t\n/' "$file"
- echo -e "\t\t" >> "$file"
+ sed -i '1s/^/\t\t\t\t\n/' "$file"
+ # Also remove the newline at the end of the file.
+ sed -i '$ d' "$file"
+ echo -e "\t\t\t\t" >> "$file"
# Add the canto number attribute (at most 160/3 ~ 54 terzine)
for i in $(seq 1 54);
do