and write to target file:
while IFS= read -r line; do
# Check if line is Title:
if [[ $line =~ \
(.*)\<\/h2\> ]]; then
# Extract the text between :
text="${BASH_REMATCH[1]}"
# Write to Tags:
echo " " >> "$target_file"
# Write actual Text:
echo " $text" >> "$target_file"
# Write to Tags:
echo " https://projectcwc.catwithcode.moe/Dev_Log/Dev_Log.html" >> "$target_file"
fi
# If just wrote Titel then:
if [[ $(tail -n 1 "$target_file") == " https://projectcwc.catwithcode.moe/Dev_Log/Dev_Log.html" ]]; then
# Get actual Text:
line_counter=$((line_counter + 1))
# After 3 lines, write the current line to the target file:
if [ $line_counter -eq 3 ]; then
# Reset:
line_counter=0
# Write Disc. and Tags:
echo " $line" >> "$target_file"
echo " " >> "$target_file"
fi
fi
done < "$source_file"
# Closing Tags:
echo "
" >> "$target_file"
echo "" >> "$target_file"
# Clean the target file by removing HTML-Tags:
# u:
sed -i 's///g; s/<\/u>//g' "$target_file"
# h3:
sed -i 's/