* NOT A DUPLICATE BECAUSE I WANT TO USE SED. *
I'm trying write a script that used sed on strings containing characters like (, [, /, \, * and spaces
I was having trouble with grep until I found the option -F: "Interpret pattern as a set of fixed strings"
How can I make sed behave the same way? I can't find any useful options.
The script is called with the string to be replaced, e.g. scriptname '\/-2])*' 'cat'
means I want \/-2])*
to be replaced with cat
In my script I set the strings as variables:
from="${1}"
to="${2}"
I fixed it to sed "s/'"$from"'/'"$to"'/g"
and am trying to run scriptname 'dog c' 'cat'
but it says sed: 1: "c'/'cat'/g": command c expects \ followed by text
Ive tried so many things and I don't know how to make this work!