WARNING!

MAKE BACKUP of current folder before proceeding!

per default it will search the current folder the user is in.

# make backup of current folder
mkdir /root/backups
tar fcvz /root/backups/backup_of_current_folder.tar.gz .

# make new file
vim /root/scripts/global-search-replace.sh
# with content

#!/bin/bash
echo "=== global-search-replace.sh v1.0 ==="
echo "WARNING! MAKE BACKUP OF ALL FILES BELOW . BEFORE PROCEEDING!"
echo "INPUT ONLY SED ESCAPED STRINGS! (https://dwaves.org/tools/escape/)"
echo "(hit enter to continue searching for:"
echo "FILETYPE: "
echo "$1"
echo "and replace all:"
echo "$2"
echo "with:"
echo "$3"
echo "in all files in all sub-folders of the current dir)"

read input

THIS=$2
# shall become
THAT=$3

find . -type f -iname "$1" -exec sed --debug -i "s/$THIS/$THAT/g" {} \;

make runnable:

chmod +x /root/scripts/*.sh

usage:

/root/scripts/global-search-replace.sh "*.txt" '\ ' ' '
admin