I have a large file which has special characters in it. There is a multi line code there, that I want to replace with sed
.
This:
text = "\
------ ------\n\n\
This message was automatically generated by email software\n\
The delivery of your message has not been affected.\n\n\
------ ------\n\n"
Needs to turn into this:
text = ""
I tried the following code, but no luck:
sed -i '/ text = "*/ {N; s/ text = .*affected.\./ text = ""/g}' /etc/exim.conf
It does not replace anything and does not display any error messages
I have been playing with it, but everything I try does not work.
sed
or are you open to other tools? Can there be"
inside thetext=
block? Can there be other cases oftext =
in your file? Will there always be 4 lines of text or can there be more/less? – terdon Feb 19 '16 at 12:42sed
, or anything that does not require installation in a CentOS server. Out of the box tools – blade19899 Feb 19 '16 at 12:43text =
in the folder, the out come needs to betext = ""
. The files has 891 lines of code. SO, it needs te respect the other text. – blade19899 Feb 19 '16 at 12:45text = ""
. As seen in my question. – blade19899 Feb 19 '16 at 12:47