0

I have a varibale TMP have string and I am using that string to be replaced using sed command to null.

TMP variable has string like this "dec$|fgh$|yxz$" and I am using this command

example.txt file contains string like this hello dec$|fgh$|yxz$

sed -i "s/hello \"$TMP\"//g" /example.txt

But this command is not replacing?

  • @Stéphane Chazelas no I am not getting help from that answer – Gaurav Baghel Jun 22 '22 at 13:34
  • What have you tried? Also, your code seems to want to remove occurrences of hello "dec$|fgh$|yxz$" but you say your input has hello dec$|fgh$|yxz$ instead. Get the text you want to remove into a $lhs variable (maybe lhs="hello $TMP") and use the method given in the dup Q&A to get your $escaped_lhs. – Stéphane Chazelas Jun 22 '22 at 16:31

0 Answers0