Unix shell replacing a word containing a back link in a file

I have a sql file ( samplesqlfile) and I want to replace a line containing backlinks with a different line. Below is the code.

actualtext="FROM sampledatabase.\`Datatype\`"
replacetext="FROM sampledatabase.\`Datatype_details\`"
sed -i "s/\<${actualtext}\>/${replacetext}/g" samplesqlfile

This does not work. Actual word to replace

FROM sampledatabase.`Datatype`

I added backslashes to avoid backward steps. But still it does not work. Please, help.

+4
source share
1 answer

Please note that this does not work:

$ sed "s/\<${actualtext}\>/${replacetext}/g" samplesqlfile
FROM sampledatabase.`Datatype`

But it does:

$ sed "s/\<${actualtext}/${replacetext}/g" samplesqlfile
FROM sampledatabase.`Datatype_details`

\>. $actualtext . . , \> . \>.

, \> , . - .

\> GNU. BSD/OSX sed .

-i. , , .

+3

All Articles