This script will recursively (all subfolders) replace all text == OLD_TEXT with NEW_TEXT in HTML files.
Get file:
$ wget https://bytesofprogress.net/resources/bash-tools/replace-lines/replace-lines.sh
Contents of file:
#!/bin/bash
INPUTFILE="input.txt"
OUTPUTFILE="output.txt"
# Does the file exist?
if [ ! -f "$INPUTFILE" ]; then
echo "ERROR: File $INPUTFILE does not exist!"
exit 1
fi
# Removing all comments & empty lines.
sed 's/#.*$//' "$INPUTFILE" | grep -v '^[[:space:]]*$' > "$OUTPUTFILE"
# Show line count before and after.
echo "Output saved as: $OUTPUTFILE"
echo "Original: $(wc -l < "$INPUTFILE") lines | Cleaned: $(wc -l < "$OUTPUTFILE") Lines."