Answers for "bash replace substring in string"

5

bash replace substring

echo [string] | sed "s/[original]/[target]/g"
Posted by: Guest on May-23-2020
0

bash replace substring in string

#!/bin/bash
firstString="I love Suzi and Marry"
secondString="Sara"
echo "${firstString/Suzi/$secondString}"    
# prints 'I love Sara and Marry'
Posted by: Guest on April-29-2021

Code answers related to "bash replace substring in string"

Browse Popular Code Answers by Language