• Source
    1. #
    2. #Accept strings and replace a string by another string.
    3. #
    4. echo -n "Enter String: "
    5. read str
    6. echo "Your string is :" $str
    7. echo -n "Enter word that you want to replace with other word: "
    8. read oldstr
    9. echo -n "Enter new word: "
    10. read newstr
    11. str=`echo $str | sed s/$oldstr/$newstr/g`
    12. echo "After Replacing: " $str