Replace one substring for another string in shell script
Asked 07 September, 2021
Viewed 1.2K times
  • 57
Votes

I have "I love Suzi and Marry" and I want to change "Suzi" to "Sara".

#!/bin/bash
firstString="I love Suzi and Marry"
secondString="Sara"
# do something...

The result must be like this:

firstString="I love Sara and Marry"

10 Answer