1) Make a file abc,sh.
$ touch abc.sh
2) Insert the script into abc,sh.
$ vi abc.sh press i, then paste
#/bin/bash
cat filename
echo "enter the newstring"
read new
echo "enter the oldstring"
read old
sed -i "s/$old/$new/g" test
3) sh abc.sh
Output:
------
enter the newstring
new
enter the oldstring
old
------
0 comments:
Post a Comment