I'm new to shell scripting and i'm having a situation here. I have a text file (let's call it `text`). I have `file1` which contains a string which needs to be replaced in file `text` with the string that is in `file2`. How could I make such a change? Also, all three files can contain special characters and `file1` and `file2` have only one line. Result should be saved in a separate file.

I've tried using `sed` and `tr` commands but I'm not sure how to make them use string from the file.