There are multiple ways of replacing a word or a string with another in a stream of input. Here, in this article, we use “sed” command.  While the “sed” command operates on one file at a time, the bash script takes care of iterating it through multiple files and making backups of original files. Run the following script with no arguments to view help.

#!/bin/bash

usage() {
echo Usage: $0 str-from str-to files
echo e.g: $0 "this string" "that ring" file1.txt file2.txt file3.txt
exit 1
}

if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" More >