I know there are lots of similar questions but, I guess because of the formatting of the search/replace variables they are not working for my situation.

The overall script I am working on will read a text file (using combinations of grep and awk) to create two shell variables, $find and $replace. $find is a single line string containing all manner of characters. $replace is a multiline string containing all manner of characters.

example:

```
echo "$find"

```

returns

```
type result input1 another_input random_input<10> / name

```

and

```
echo "$replace"

```

returns

```
.TAG name
result input1 random_input / name1
random_input<10> input1 another_input / name2
.NTAG

```

Now I just need to substitute $find with $replace. I have tried sed and perl but it fails.

Tried (among a lot of other stuff)

```
perl -e -i.bak "s/$find/$replace/g" text.file
perl -e -i.bak 's,"'$find'","'$replace'",g' text.file
perl -e -i.bak "s|$find|$replace|g" text.file

```

and

```
sed -i "s/$find/$replace/g" text.file

```

My guess is the problems are caused by some character in the string being interpreted as special characters.

Any help is appreciated!