Browse Source

rename num attrs

main
lhess2021 4 years ago
parent
commit
dff463dc44
  1. 4
      shell-scripts.d/tercet-tags.sh

4
shell-scripts.d/tercet-tags.sh

@ -12,9 +12,9 @@ do
# 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\t\t</tercet>\n\t\t\t\t<tercet num=~NUM~>"}' "$file"
awk -i inplace '{print}; NR % 3 == 0 {print "\t\t\t\t</tercet>\n\t\t\t\t<tercet t_num=~NUM~>"}' "$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\t\t<tercet num="1">\n/' "$file"
sed -i '1s/^/\t\t\t\t<tercet t_num="1">\n/' "$file"
# Also remove the newline at the end of the file.
sed -i '$ d' "$file"
echo -e "\t\t\t\t</tercet>" >> "$file"

Loading…
Cancel
Save